diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts
index d2d34fee3..9221b0941 100644
--- a/app/src/block/Panel.ts
+++ b/app/src/block/Panel.ts
@@ -129,7 +129,7 @@ export class BlockPanel {
target = target.parentElement;
}
});
- /// if !MOBILE
+ /// #if !MOBILE
moveResize(this.element, (type: string) => {
if (type !== "move") {
this.editors.forEach(item => {
diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts
index 8ff837dcb..acd36cb68 100644
--- a/app/src/dialog/index.ts
+++ b/app/src/dialog/index.ts
@@ -1,5 +1,5 @@
import {genUUID} from "../util/genID";
-/// if !MOBILE
+/// #if !MOBILE
import {moveResize} from "./moveResize";
/// #endif
import {isMobile} from "../util/functions";
@@ -59,7 +59,7 @@ export class Dialog {
this.element.classList.add("b3-dialog--open");
});
}
- /// if !MOBILE
+ /// #if !MOBILE
moveResize(this.element.querySelector(".b3-dialog__container"));
/// #endif
}
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 9be25bf8b..ff95c2be7 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -22,7 +22,7 @@ import {getSearch} from "../util/functions";
import {initRightMenu} from "./menu";
import {openChangelog} from "../boot/openChangelog";
import {registerServiceWorker} from "../util/serviceWorker";
-import {loadPlugins} from "../plugin/loader";
+import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
class App {
public plugins: import("../plugin").Plugin[] = [];
@@ -81,6 +81,9 @@ class App {
initFramework(this);
initRightMenu(this);
openChangelog();
+ this.plugins.forEach(item => {
+ afterLoadPlugin(item);
+ });
});
});
});
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index ade72c197..0c8cc257e 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -68,6 +68,7 @@ export class Plugin {
const iconElement = document.createElement("div");
if (isMobile()) {
iconElement.className = "b3-menu__item";
+ iconElement.setAttribute("data-menu", "true");
iconElement.innerHTML = (options.icon.startsWith("icon") ? `` : options.icon) +
``;
iconElement.addEventListener("click", options.callback);
diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts
index c18b0def4..1a1cc89e8 100644
--- a/app/src/plugin/loader.ts
+++ b/app/src/plugin/loader.ts
@@ -104,19 +104,20 @@ export const afterLoadPlugin = (plugin: Plugin) => {
console.error(`plugin ${plugin.name} onLayoutReady error:`, e);
}
+ if (!isWindow() || isMobile()) {
+ plugin.topBarIcons.forEach(element => {
+ if (isMobile()) {
+ document.querySelector("#menuAbout").after(element);
+ } else if (!isWindow()) {
+ document.querySelector("#" + (element.getAttribute("data-position") === "right" ? "barSearch" : "drag")).before(element);
+ }
+ });
+ }
if (isWindow()) {
return;
}
- plugin.topBarIcons.forEach(element => {
- if (isMobile()) {
- document.querySelector("#menuAbout").after(element);
- } else if (!isWindow()) {
- document.querySelector("#" + (element.getAttribute("data-position") === "right" ? "barSearch" : "drag")).before(element);
- }
- });
-
- /// if !MOBILE
+ /// #if !MOBILE
window.siyuan.config.uiLayout.left.data.forEach((dockItem: IDockTab[], index: number) => {
updateDock(dockItem, index, plugin, "Left");
});
@@ -157,5 +158,5 @@ export const afterLoadPlugin = (plugin: Plugin) => {
}], dock.config.position === "RightBottom" ? 1 : 0, dock.config.index);
}
});
- /// endif
+ /// #endif
};
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 3d76c3e0c..2945dbbe9 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -26,7 +26,7 @@ import {blockRender} from "../markdown/blockRender";
/// #if !BROWSER
import {openBy} from "../../editor/util";
/// #endif
-/// if !MOBILE
+/// #if !MOBILE
import {moveResize} from "../../dialog/moveResize";
/// #endif
import {fetchPost} from "../../util/fetch";
@@ -1013,7 +1013,7 @@ export class Toolbar {
});
}, Constants.TIMEOUT_LOAD);
};
- /// if !MOBILE
+ /// #if !MOBILE
moveResize(this.subElement, () => {
const pinElement = headerElement.querySelector('[data-type="pin"]');
pinElement.classList.add("block__icon--active");