diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 1c840181c..ce96228f6 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -56,10 +56,7 @@ export const openFileById = async (options: { showMessage(response.msg); return; } - - // 更新文档浏览时间 - fetchPost("/api/storage/updateRecentDocViewTime", {rootID: response.data.rootID}); - + return openFile({ app: options.app, fileName: response.data.rootTitle, diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index 2ceddf9f4..28b872207 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -43,6 +43,8 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[ pushBack(); scrollCenter(window.siyuan.mobile.editor.protyle, blockElement, true); closePanel(); + // 更新文档浏览时间 + fetchPost("/api/storage/updateRecentDocViewTime", {rootID: window.siyuan.mobile.editor.protyle.block.rootID}); return; } } @@ -52,9 +54,6 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[ showMessage(data.msg); return; } - - // 更新文档浏览时间 - fetchPost("/api/storage/updateRecentDocViewTime", {rootID: data.data.rootID}); const protyleOptions: IProtyleOptions = { blockId: id, rootId: data.data.rootID, @@ -77,6 +76,9 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[ addLoading(window.siyuan.mobile.editor.protyle); if (window.siyuan.mobile.editor.protyle.block.rootID !== data.data.rootID) { window.siyuan.mobile.editor.protyle.wysiwyg.element.innerHTML = ""; + fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: data.data.rootID}); + } else { + fetchPost("/api/storage/updateRecentDocViewTime", {rootID: data.data.rootID}); } if (action.includes(Constants.CB_GET_SCROLL) && window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID]) { getDocByScroll({ @@ -109,6 +111,7 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[ } window.siyuan.mobile.editor.protyle.undo.clear(); } else { + fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: data.data.rootID}); window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions); } setEditor();