From f9e81c75f2e1dd8d4d14b21819e4d7498d4141a5 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 6 May 2023 10:59:23 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/8184 --- app/src/mobile/util/onMessage.ts | 1 - app/src/util/newFile.ts | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.ts index 73554fede..54e62ff56 100644 --- a/app/src/mobile/util/onMessage.ts +++ b/app/src/mobile/util/onMessage.ts @@ -33,7 +33,6 @@ export const onMessage = (data: IWebSocketData) => { document.getElementById("toolbarSync").classList.add("fn__none"); } break; - case "create": case "createdailynote": openMobileFileById(data.data.id); break; diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index 77f7044ec..e92b4c46a 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -83,6 +83,8 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin }, response => { /// #if !MOBILE openFileById({id: response.data, action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]}); + /// #else + openMobileFileById(response.data, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); /// #endif }); } else { @@ -97,6 +99,8 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin }, response => { /// #if !MOBILE openFileById({id: response.data, action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]}); + /// #else + openMobileFileById(response.data, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); /// #endif }); }); @@ -121,6 +125,8 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin }, () => { /// #if !MOBILE openFileById({id, action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]}); + /// #else + openMobileFileById(id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); /// #endif }); } @@ -165,11 +171,11 @@ export const newFileByName = (value: string) => { markdown: "" }, response => { hideElements(["dialog"]); - if (isMobile()) { - openMobileFileById(response.data, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); - } else { - openFileById({id: response.data, action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]}); - } + /// #if MOBILE + openMobileFileById(response.data, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]); + /// #else + openFileById({id: response.data, action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]}); + /// #endif }); }); };