From 76fd4c280a47f64ba42ec0b3fa60081be38d2525 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 10 Jun 2022 00:06:51 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5144 --- app/src/mobile/util/MobileFiles.ts | 4 ++++ app/src/util/newFile.ts | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/mobile/util/MobileFiles.ts b/app/src/mobile/util/MobileFiles.ts index fae7f3f86..e1cf297a4 100644 --- a/app/src/mobile/util/MobileFiles.ts +++ b/app/src/mobile/util/MobileFiles.ts @@ -499,6 +499,10 @@ export class MobileFiles extends Model { } else { targetElement.remove(); } + + if (window.siyuan.mobileEditor && window.siyuan.mobileEditor.protyle.path === data.data.path) { + setEmpty(); + } } } diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index f056ecb49..482638da0 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -7,6 +7,8 @@ import {fetchPost} from "./fetch"; import {getDisplayName, getOpenNotebookCount, pathPosix} from "./pathName"; import {openFileById} from "../editor/util"; import {Constants} from "../constants"; +import {isMobile} from "./functions"; +import {openMobileFileById} from "../mobile/editor"; export const newFile = (notebookId?: string, currentPath?: string, open?: boolean) => { if (getOpenNotebookCount() === 0) { @@ -57,7 +59,11 @@ export const newFile = (notebookId?: string, currentPath?: string, open?: boolea md: "", }, () => { if (open) { - openFileById({id, hasContext: true, action: [Constants.CB_GET_HL]}); + if (isMobile()) { + openMobileFileById(id, true); + } else { + openFileById({id, hasContext: true, action: [Constants.CB_GET_HL]}); + } } }); });