Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/10155

Vanessaace4d5c9e02e
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 2341b9c8b7..5bb2551f07 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -124,6 +124,7 @@ const setHTML = (options: {
}
protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL);
const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8;
+ const isUpdate = protyle.wysiwyg.element.innerHTML !== ""
if (options.action.includes(Constants.CB_GET_APPEND)) {
// 动态加载移除
if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {
@@ -198,7 +199,7 @@ const setHTML = (options: {
protyle.breadcrumb.element.nextElementSibling.textContent = "";
}
protyle.element.removeAttribute("disabled-forever");
- setReadonlyByConfig(protyle, options.action);
+ setReadonlyByConfig(protyle, isUpdate);
}
focusElementById(protyle, options.action, options.scrollAttr);
@@ -431,9 +432,9 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
}
};
-export const setReadonlyByConfig = (protyle: IProtyle, action: string[]) => {
+export const setReadonlyByConfig = (protyle: IProtyle, isUpdate: boolean) => {
let readOnly = window.siyuan.config.readonly ? "true" : "false";
- if (action?.includes(Constants.CB_GET_UNCHANGEID)) {
+ if (isUpdate) {
readOnly = protyle.disabled ? "true" : "false";
} else if (readOnly === "false") {
readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";