Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:mobile: https://github.com/siyuan-note/siyuan/issues/8371

Vanessa7e114a6671c0
diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts
index d2d34fee31..9221b09411 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 8ff837dcbc..acd36cb689 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 9be25bf8b3..ff95c2be7b 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 ade72c197f..0c8cc257e3 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") ? `<svg class="b3-menu__icon"><use xlink:href="#${options.icon}"></use></svg>` : options.icon) +
`<span class="b3-menu__label">${options.title}</span>`;
iconElement.addEventListener("click", options.callback);
diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts
index c18b0def48..1a1cc89e88 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 3d76c3e0c8..2945dbbe91 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");