This commit is contained in:
Vanessa 2023-04-02 12:16:33 +08:00 committed by Liang Ding
parent 295caac056
commit c2918f3cbd
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 20 additions and 5 deletions

View file

@ -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", {

View file

@ -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;
}