An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/9767
Vanessaec29bc7071f9
diff --git a/app/src/config/editor.ts b/app/src/config/editor.tsindex acb85e8bd6..b989208b95 100644--- a/app/src/config/editor.ts+++ b/app/src/config/editor.ts@@ -343,9 +343,7 @@ export const editor = {}window.siyuan.config.editor = editorData;getAllModels().editor.forEach((item) => {- if (!changeReadonly) {- reloadProtyle(item.editor.protyle, false);- }+ reloadProtyle(item.editor.protyle, false);let isFullWidth = item.editor.protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);if (!isFullWidth) {isFullWidth = window.siyuan.config.editor.fullWidth ? "true" : "false";diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.tsindex f5d2f1ada0..3b3bcad986 100644--- a/app/src/mobile/util/MobileBackFoward.ts+++ b/app/src/mobile/util/MobileBackFoward.ts@@ -6,7 +6,7 @@ import {zoomOut} from "../../menus/protyle";import {processRender} from "../../protyle/util/processCode";import {highlightRender} from "../../protyle/render/highlightRender";import {blockRender} from "../../protyle/render/blockRender";-import {disabledForeverProtyle, disabledProtyle, enableProtyle} from "../../protyle/util/onGet";+import {disabledForeverProtyle, setReadonlyByConfig} from "../../protyle/util/onGet";import {setStorageVal} from "../../protyle/util/compatibility";import {closePanel} from "./closePanel";import {showMessage} from "../../dialog/message";@@ -92,18 +92,7 @@ const focusStack = (backStack: IBackStack) => {if (getResponse.data.isSyncing) {disabledForeverProtyle(protyle);} else {- let readOnly = window.siyuan.config.readonly ? "true" : "false";- if (readOnly === "false") {- readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";- if (readOnly === "false") {- readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);- }- }- if (readOnly === "true") {- disabledProtyle(protyle);- } else {- enableProtyle(protyle);- }+ setReadonlyByConfig(protyle);}protyle.contentElement.scrollTop = backStack.scrollTop;});diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 0fb2f45e67..df4d271a31 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -28,7 +28,7 @@ import {updatePanelByEditor} from "../editor/util";import {setPanelFocus} from "../layout/util";/// #endifimport {Background} from "./header/Background";-import {onGet} from "./util/onGet";+import {onGet, setReadonlyByConfig} from "./util/onGet";import {reloadProtyle} from "./util/reload";import {renderBacklink} from "./wysiwyg/renderBacklink";import {setEmpty} from "../mobile/util/setEmpty";@@ -132,7 +132,7 @@ export class Protyle {break;case "readonly":window.siyuan.config.editor.readOnly = data.data;- reloadProtyle(this.protyle, false);+ setReadonlyByConfig(this.protyle);break;case "heading2doc":case "li2doc":diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex da8cc6e9af..b8fc3eef01 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -240,18 +240,7 @@ const setHTML = (options: {protyle.breadcrumb.element.nextElementSibling.textContent = "";}protyle.element.removeAttribute("disabled-forever");- let readOnly = window.siyuan.config.readonly ? "true" : "false";- if (readOnly === "false") {- readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";- if (readOnly === "false") {- readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);- }- }- if (readOnly === "true") {- disabledProtyle(protyle);- } else {- enableProtyle(protyle);- }+ setReadonlyByConfig(protyle);}if (options.action.includes(Constants.CB_GET_SETID)) {// 点击大纲后,如果需要动态加载,在定位后,需要重置 block.id https://github.com/siyuan-note/siyuan/issues/4487@@ -411,3 +400,18 @@ const focusElementById = (protyle: IProtyle, action: string[]) => {/// #endif}};++export const setReadonlyByConfig = (protyle: IProtyle) => {+ let readOnly = window.siyuan.config.readonly ? "true" : "false";+ if (readOnly === "false") {+ readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";+ if (readOnly === "false") {+ readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);+ }+ }+ if (readOnly === "true") {+ disabledProtyle(protyle);+ } else {+ enableProtyle(protyle);+ }+}