Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/11133

Vanessaf15b2f866667
diff --git a/app/src/boot/globalEvent/command/global.ts b/app/src/boot/globalEvent/command/global.ts
index ad388d3eac..beb7f02410 100644
--- a/app/src/boot/globalEvent/command/global.ts
+++ b/app/src/boot/globalEvent/command/global.ts
@@ -4,6 +4,7 @@ import {Editor} from "../../../editor";
/// #if MOBILE
import {openDock} from "../../../mobile/dock/util";
import {popMenu} from "../../../mobile/menu";
+import {popSearch} from "../../../mobile/menu/search";
/// #else
import {openSearch} from "../../../search/spread";
import {goBack, goForward} from "../../../util/backForward";
@@ -14,8 +15,8 @@ import {openSetting} from "../../../config";
import {Tab} from "../../../layout/Tab";
/// #endif
import {App} from "../../../index";
-import {editor} from "../../../config/editor";
import {Constants} from "../../../constants";
+import {setReadOnly} from "../../../config/util/setReadOnly";
export const globalCommand = (command: string, app: App) => {
/// #if MOBILE
@@ -35,6 +36,9 @@ export const globalCommand = (command: string, app: App) => {
case "config":
popMenu();
return true;
+ case "globalSearch":
+ popSearch(app);
+ return true;
}
/// #else
switch (command) {
@@ -225,7 +229,7 @@ export const globalCommand = (command: string, app: App) => {
openHistory(app);
return true;
case "editReadonly":
- editor.setReadonly(!window.siyuan.config.editor.readOnly);
+ setReadOnly(!window.siyuan.config.editor.readOnly)
return true;
}
diff --git a/app/src/boot/globalEvent/command/panel.ts b/app/src/boot/globalEvent/command/panel.ts
index 7a1b311ebb..969060f816 100644
--- a/app/src/boot/globalEvent/command/panel.ts
+++ b/app/src/boot/globalEvent/command/panel.ts
@@ -45,7 +45,7 @@ export const commandPanel = (app: App) => {
let keys;
/// #if MOBILE
keys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks", "config",
- "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch", "goBack", "goForward"];
+ "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch"];
/// #else
keys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks",
"graphView", "globalGraph", "closeAll", "closeLeft", "closeOthers", "closeRight", "closeTab",
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index 91d2326121..1981f7f54b 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -74,6 +74,7 @@ import {zoomOut} from "../../menus/protyle";
import {getPlainText} from "../../protyle/util/paste";
import {commandPanel, execByCommand} from "./command/panel";
import {filterHotkey} from "./commonHotkey";
+import {setReadOnly} from "../../config/util/setReadOnly";
const switchDialogEvent = (app: App, event: MouseEvent) => {
event.preventDefault();
@@ -1266,7 +1267,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
}
if (matchHotKey(window.siyuan.config.keymap.general.editReadonly.custom, event)) {
event.preventDefault();
- editor.setReadonly(!window.siyuan.config.editor.readOnly);
+ setReadOnly(!window.siyuan.config.editor.readOnly)
return;
}
if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) {
diff --git a/app/src/config/editor.ts b/app/src/config/editor.ts
index 97321958c0..79447c8a89 100644
--- a/app/src/config/editor.ts
+++ b/app/src/config/editor.ts
@@ -6,13 +6,10 @@ import {reloadProtyle} from "../protyle/util/reload";
import {updateHotkeyTip} from "../protyle/util/compatibility";
import {Constants} from "../constants";
import {resize} from "../protyle/util/resize";
+import {setReadOnly} from "./util/setReadOnly";
export const editor = {
element: undefined as Element,
- setReadonly: (readOnly: boolean) => {
- window.siyuan.config.editor.readOnly = readOnly;
- fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
- },
genHTML: () => {
let fontFamilyHTML = "";
fontFamilyHTML = '<select id="fontFamily" class="b3-select fn__flex-center fn__size200"></select>';
@@ -401,7 +398,7 @@ export const editor = {
_onSetEditor: (editorData: Config.IEditor) => {
const changeReadonly = editorData.readOnly !== window.siyuan.config.editor.readOnly;
if (changeReadonly) {
- editor.setReadonly(editorData.readOnly);
+ setReadOnly(editorData.readOnly);
}
window.siyuan.config.editor = editorData;
getAllModels().editor.forEach((item) => {