From c2918f3cbd61216002c1daf778de8965ec693045 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 2 Apr 2023 12:16:33 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/7854 --- app/src/mobile/editor.ts | 4 +++- app/src/protyle/index.ts | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index 61df9e53d..09888dfdf 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -45,7 +45,9 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) = return; } if (window.siyuan.mobile.editor) { - saveScroll(window.siyuan.mobile.editor.protyle); + if (document.getElementById("empty").classList.contains("fn__none")) { + saveScroll(window.siyuan.mobile.editor.protyle); + } pushBack(); addLoading(window.siyuan.mobile.editor.protyle); fetchPost("/api/filetree/getDoc", { diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts index 19d0338b8..e027ea817 100644 --- a/app/src/protyle/index.ts +++ b/app/src/protyle/index.ts @@ -25,6 +25,7 @@ import {Background} from "./header/Background"; import {disabledProtyle, enableProtyle, onGet} from "./util/onGet"; import {reloadProtyle} from "./util/reload"; import {renderBacklink} from "./wysiwyg/renderBacklink"; +import {setEmpty} from "../mobile/util/setEmpty"; export class Protyle { @@ -149,13 +150,25 @@ export class Protyle { } break; case "unmount": - if (this.protyle.model && this.protyle.notebookId === data.data.box) { - this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false); + if (this.protyle.notebookId === data.data.box) { + /// #if MOBILE + setEmpty(); + /// #else + if (this.protyle.model) { + this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false); + } + /// #endif } break; case "removeDoc": - if (this.protyle.model && data.data.ids.includes(this.protyle.block.rootID)) { - this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false); + if (data.data.ids.includes(this.protyle.block.rootID)) { + /// #if MOBILE + setEmpty(); + /// #else + if (this.protyle.model) { + this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false); + } + /// #endif } break; }