Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/11981

Vanessa9adb99364ac7
diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts
index 983bacf9c6..7d0e201123 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 e544885b80..e5c7f1c498 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 a8413be5f2..bea7bdccd3 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 2426ab9bab..4358355330 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;