diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts index 983bacf9c..7d0e20112 100644 --- a/app/src/layout/dock/index.ts +++ b/app/src/layout/dock/index.ts @@ -594,7 +594,7 @@ export class Dock { type: "pin", tab, blockId: editor?.protyle?.block?.rootID, - isPreview: !editor?.protyle?.preview?.element.classList.contains("fn__none") + isPreview: editor?.protyle?.preview ? editor.protyle.preview.element.classList.contains("fn__none") : false }); if (editor?.protyle?.title?.editElement) { outline.updateDocTitle(editor.protyle?.background?.ial); diff --git a/app/src/mobile/dock/MobileOutline.ts b/app/src/mobile/dock/MobileOutline.ts index e544885b8..e5c7f1c49 100644 --- a/app/src/mobile/dock/MobileOutline.ts +++ b/app/src/mobile/dock/MobileOutline.ts @@ -58,17 +58,6 @@ export class MobileOutline { } public update() { - if (!window.siyuan.mobile.editor.protyle.preview.element.classList.contains("fn__none")) { - const blockId = window.siyuan.mobile.editor.protyle.preview.element.querySelector(".selected")?.id; - window.siyuan.mobile.editor.protyle.preview.render(window.siyuan.mobile.editor.protyle, (outlineData) => { - this.tree.updateData(outlineData); - if (blockId) { - this.setCurrentByPreview(this.element.querySelector("#" + blockId)); - return; - } - }); - return; - } fetchPost("/api/outline/getDocOutline", { id: window.siyuan.mobile.editor.protyle.block.rootID, preview: !window.siyuan.mobile.editor.protyle.preview.element.classList.contains("fn__none") diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts index a8413be5f..bea7bdccd 100644 --- a/app/src/protyle/preview/index.ts +++ b/app/src/protyle/preview/index.ts @@ -191,9 +191,6 @@ export class Preview { avRender(protyle.preview.previewElement, protyle); speechRender(protyle.preview.previewElement, protyle.options.lang); protyle.preview.previewElement.scrollTop = oldScrollTop; - /// #if !MOBILE - updateOutline(getAllModels(), protyle); - /// #endif loadingElement.remove(); }); }, protyle.options.preview.delay); diff --git a/app/src/protyle/util/setEditMode.ts b/app/src/protyle/util/setEditMode.ts index 2426ab9ba..435835533 100644 --- a/app/src/protyle/util/setEditMode.ts +++ b/app/src/protyle/util/setEditMode.ts @@ -16,6 +16,9 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => { protyle.breadcrumb.toggleExit(true); } protyle.preview.render(protyle); + /// #if !MOBILE + updateOutline(getAllModels(), protyle, true); + /// #endif } else if (type === "wysiwyg") { if (!protyle.contentElement.classList.contains("fn__none")) { return;