mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 02:22:36 +08:00
This commit is contained in:
parent
f67bd1ad7f
commit
a905742464
@ -162,7 +162,7 @@ export class Plugin {
|
||||
public addTopBar(options: {
|
||||
icon: string,
|
||||
title: string,
|
||||
position?: "right" | "left",
|
||||
position?: "south" | "left",
|
||||
callback: (evt: MouseEvent) => void
|
||||
}) {
|
||||
if (!options.icon.startsWith("icon") && !options.icon.startsWith("<svg")) {
|
||||
@ -182,7 +182,7 @@ export class Plugin {
|
||||
iconElement.setAttribute("aria-label", options.title);
|
||||
iconElement.innerHTML = options.icon.startsWith("icon") ? `<svg><use xlink:href="#${options.icon}"></use></svg>` : options.icon;
|
||||
iconElement.addEventListener("click", options.callback);
|
||||
iconElement.setAttribute("data-position", options.position || "right");
|
||||
iconElement.setAttribute("data-location", options.position || "right");
|
||||
}
|
||||
this.topBarIcons.push(iconElement);
|
||||
return iconElement;
|
||||
@ -193,7 +193,7 @@ export class Plugin {
|
||||
position?: "right" | "left",
|
||||
}) {
|
||||
/// #if !MOBILE
|
||||
options.element.setAttribute("data-position", options.position || "right");
|
||||
options.element.setAttribute("data-location", options.position || "right");
|
||||
this.statusBarIcons.push(options.element);
|
||||
return options.element;
|
||||
/// #endif
|
||||
|
@ -132,7 +132,7 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
||||
if (window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(element.id)) {
|
||||
element.classList.add("fn__none");
|
||||
}
|
||||
document.querySelector("#" + (element.getAttribute("data-position") === "right" ? "barPlugins" : "drag")).before(element);
|
||||
document.querySelector("#" + (element.getAttribute("data-location") === "right" ? "barPlugins" : "drag")).before(element);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -140,7 +140,7 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
||||
resizeTopBar();
|
||||
plugin.statusBarIcons.forEach(element => {
|
||||
const statusElement = document.getElementById("status");
|
||||
if (element.getAttribute("data-position") === "right") {
|
||||
if (element.getAttribute("data-location") === "right") {
|
||||
statusElement.insertAdjacentElement("beforeend", element);
|
||||
} else {
|
||||
statusElement.insertAdjacentElement("afterbegin", element);
|
||||
|
Loading…
Reference in New Issue
Block a user