Browse Source

:bug: fix https://github.com/siyuan-note/siyuan/issues/5297

Vanessa 3 years ago
parent
commit
59bff8376a
3 changed files with 9 additions and 4 deletions
  1. 1 1
      app/src/editor/index.ts
  2. 7 2
      app/src/protyle/index.ts
  3. 1 1
      app/src/protyle/util/onGet.ts

+ 1 - 1
app/src/editor/index.ts

@@ -46,7 +46,6 @@ export class Editor extends Model {
             },
             typewriterMode: true,
             after: (editor) => {
-                editor.protyle.model = this;
                 if (window.siyuan.config.readonly) {
                     disabledProtyle(editor.protyle);
                 }
@@ -63,5 +62,6 @@ export class Editor extends Model {
                 }
             },
         });
+        this.editor.protyle.model = this;
     }
 }

+ 7 - 2
app/src/protyle/index.ts

@@ -104,8 +104,13 @@ class Protyle {
                         }
                         break;
                     case "rename":
-                        if (this.protyle.path === data.data.path && this.protyle.model) {
-                            this.protyle.model.parent.updateTitle(data.data.title);
+                        if (this.protyle.path === data.data.path) {
+                            if (this.protyle.model) {
+                                this.protyle.model.parent.updateTitle(data.data.title);
+                            }
+                            if (this.protyle.background) {
+                                this.protyle.background.ial.title = data.data.title
+                            }
                         }
                         if (this.protyle.options.render.title && this.protyle.block.parentID === data.data.id) {
                             if (getSelection().rangeCount > 0 && this.protyle.element.contains(getSelection().getRangeAt(0).startContainer)) {

+ 1 - 1
app/src/protyle/util/onGet.ts

@@ -206,7 +206,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt
     if (!protyle.scroll.element.classList.contains("fn__none") &&
         protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" &&
         protyle.contentElement.scrollHeight > 0 && // 没有激活的页签 https://github.com/siyuan-note/siyuan/issues/5255
-        !options.action.includes(Constants.CB_GET_FOCUSFIRST) &&
+        !options.action.includes(Constants.CB_GET_FOCUSFIRST) && // 防止 eof 为true https://github.com/siyuan-note/siyuan/issues/5291
         protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
         fetchPost("/api/filetree/getDoc", {
             id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),