Procházet zdrojové kódy

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

Vanessa před 1 rokem
rodič
revize
ace4d5c9e0
1 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 4 3
      app/src/protyle/util/onGet.ts

+ 4 - 3
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";