Skip to content

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

:heavy_plus_sign: fix https://github.com/siyuan-note/siyuan/issues/10006

Vanessa62a7a36d3cef
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index 8ab5b74f7d..a45e2eecb3 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -1260,7 +1260,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return;
}
if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) {
- lockScreen();
+ lockScreen(app);
event.preventDefault();
return;
}
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index c57fb2caa3..1834b8fde9 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -130,10 +130,13 @@ export const reloadSync = (app: App, data: { upsertRootIDs: string[], removeRoot
/// #endif
};
-export const lockScreen = () => {
+export const lockScreen = (app: App) => {
if (window.siyuan.config.readonly) {
return;
}
+ app.plugins.forEach(item => {
+ item.eventBus.emit("lock-screen");
+ });
/// #if BROWSER
fetchPost("/api/system/logoutAuth", {}, () => {
redirectToCheckAuth();
diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.ts
index cc57dc5ba7..fa5a243a5e 100644
--- a/app/src/menus/workspace.ts
+++ b/app/src/menus/workspace.ts
@@ -380,7 +380,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
icon: "iconLock",
accelerator: window.siyuan.config.keymap.general.lockScreen.custom,
click: () => {
- lockScreen();
+ lockScreen(app);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({
diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts
index 02af2002d3..da7ca47c9c 100644
--- a/app/src/mobile/menu/index.ts
+++ b/app/src/mobile/menu/index.ts
@@ -227,7 +227,7 @@ export const initRightMenu = (app: App) => {
event.stopPropagation();
break;
} else if (target.id === "menuLock") {
- lockScreen();
+ lockScreen(app);
event.preventDefault();
event.stopPropagation();
break;
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 69550064fa..0fca834486 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -63,6 +63,7 @@ type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
"loaded-protyle" | "loaded-protyle-dynamic" | "loaded-protyle-static" |
"switch-protyle" |
"destroy-protyle" |
+ "lock-screen" |
"mobile-keyboard-show" | "mobile-keyboard-hide"
type TAVCol =
"text"