Skip to content

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

:rotating_light:

Vanessab2b1089e3d84
diff --git a/app/src/boot/globalEvent/command/global.ts b/app/src/boot/globalEvent/command/global.ts
index beb7f02410..df6a164288 100644
--- a/app/src/boot/globalEvent/command/global.ts
+++ b/app/src/boot/globalEvent/command/global.ts
@@ -129,18 +129,18 @@ export const globalCommand = (command: string, app: App) => {
let newItem: Tab;
if (command === "goToEditTabPrev") {
if (index === 0) {
- newItem = tabs[tabs.length - 1]
+ newItem = tabs[tabs.length - 1];
} else {
- newItem = tabs[index - 1]
+ newItem = tabs[index - 1];
}
} else {
if (index === tabs.length - 1) {
- newItem = tabs[0]
+ newItem = tabs[0];
} else {
- newItem = tabs[index + 1]
+ newItem = tabs[index + 1];
}
}
- const tab = getInstanceById(newItem.id) as Tab
+ const tab = getInstanceById(newItem.id) as Tab;
tab.parent.switchTab(newItem.headElement);
tab.parent.showHeading();
}
@@ -229,9 +229,9 @@ export const globalCommand = (command: string, app: App) => {
openHistory(app);
return true;
case "editReadonly":
- setReadOnly(!window.siyuan.config.editor.readOnly)
+ setReadOnly(!window.siyuan.config.editor.readOnly);
return true;
}
- return false
-}
+ return false;
+};
diff --git a/app/src/boot/globalEvent/command/protyle.ts b/app/src/boot/globalEvent/command/protyle.ts
index 3cc5155c33..6a3cb0de50 100644
--- a/app/src/boot/globalEvent/command/protyle.ts
+++ b/app/src/boot/globalEvent/command/protyle.ts
@@ -25,4 +25,4 @@ export const onluProtyleCommand = (options: {
return true;
}
return false;
-}
+};
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index 1981f7f54b..f7d01aacf6 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -43,7 +43,6 @@ import {escapeHtml} from "../../util/escape";
import {syncGuide} from "../../sync/syncGuide";
import {getStartEndElement, goEnd, goHome} from "../../protyle/wysiwyg/commonHotkey";
import {getNextFileLi, getPreviousFileLi} from "../../protyle/wysiwyg/getBlock";
-import {editor} from "../../config/editor";
import {hintMoveBlock} from "../../protyle/hint/extend";
import {Backlink} from "../../layout/dock/Backlink";
/// #if !BROWSER
@@ -1267,7 +1266,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
}
if (matchHotKey(window.siyuan.config.keymap.general.editReadonly.custom, event)) {
event.preventDefault();
- 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/util/setReadOnly.ts b/app/src/config/util/setReadOnly.ts
new file mode 100644
index 0000000000..a601e86f77
--- /dev/null
+++ b/app/src/config/util/setReadOnly.ts
@@ -0,0 +1,6 @@
+import {fetchPost} from "../../util/fetch";
+
+export const setReadOnly = (readOnly: boolean) => {
+ window.siyuan.config.editor.readOnly = readOnly;
+ fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
+};
diff --git a/app/src/menus/text.ts b/app/src/menus/text.ts
index 289d6978aa..1dc1f98971 100644
--- a/app/src/menus/text.ts
+++ b/app/src/menus/text.ts
@@ -11,7 +11,7 @@ export const textMenu = (target: Element) => {
click() {
document.execCommand("copy");
}
- })
+ });
menu.addItem({
label: window.siyuan.languages.selectAll,
icon: "iconSelect",
@@ -19,8 +19,8 @@ export const textMenu = (target: Element) => {
if (getSelection().rangeCount === 0) {
return;
}
- getSelection().getRangeAt(0).selectNode(target)
+ getSelection().getRangeAt(0).selectNode(target);
}
- })
- return menu
-}
+ });
+ return menu;
+};
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index ab24428d1d..71ed641862 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -49,7 +49,7 @@ import {
getStartEndElement,
upSelect
} from "./commonHotkey";
-import {fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu, zoomOut} from "../../menus/protyle";
+import {fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu} from "../../menus/protyle";
import {openAttr} from "../../menus/commonMenuItem";
import {Constants} from "../../constants";
import {fetchPost} from "../../util/fetch";
@@ -473,7 +473,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle,
command: "enter",
previousRange: range,
- })
+ });
event.preventDefault();
event.stopPropagation();
return;
@@ -484,7 +484,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle,
command: "enterBack",
previousRange: range,
- })
+ });
event.preventDefault();
event.stopPropagation();
return;
diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts
index 91b1957d02..953cfeb475 100644
--- a/app/src/util/newFile.ts
+++ b/app/src/util/newFile.ts
@@ -98,7 +98,7 @@ export const newFile = (optios: {
}
if ((data.data.path.indexOf("/") > -1 && optios.useSavePath) || optios.name) {
if (data.data.path.startsWith("/") || optios.currentPath === "/") {
- const createPath = pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
+ const createPath = pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,
@@ -123,7 +123,7 @@ export const newFile = (optios: {
notebook: data.data.box,
path: optios.notebookId === data.data.box ? (optios.currentPath.endsWith(".sy") ? optios.currentPath : optios.currentPath + ".sy") : (data.data.path || "/")
}, (responseHPath) => {
- const createPath = pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
+ const createPath = pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,
@@ -151,7 +151,7 @@ export const newFile = (optios: {
return;
}
if (optios.notebookId !== data.data.box) {
- const createPath = pathPosix().join(data.data.path || "/", optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""))
+ const createPath = pathPosix().join(data.data.path || "/", optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : ""));
fetchPost("/api/filetree/createDocWithMd", {
notebook: data.data.box,
path: createPath,