Vanessa 2025-10-24 13:18:10 +08:00
parent 5ec6b314a9
commit 918f679a31
2 changed files with 7 additions and 7 deletions

View file

@ -56,10 +56,7 @@ export const openFileById = async (options: {
showMessage(response.msg); showMessage(response.msg);
return; return;
} }
// 更新文档浏览时间
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: response.data.rootID});
return openFile({ return openFile({
app: options.app, app: options.app,
fileName: response.data.rootTitle, fileName: response.data.rootTitle,

View file

@ -43,6 +43,8 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
pushBack(); pushBack();
scrollCenter(window.siyuan.mobile.editor.protyle, blockElement, true); scrollCenter(window.siyuan.mobile.editor.protyle, blockElement, true);
closePanel(); closePanel();
// 更新文档浏览时间
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: window.siyuan.mobile.editor.protyle.block.rootID});
return; return;
} }
} }
@ -52,9 +54,6 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
showMessage(data.msg); showMessage(data.msg);
return; return;
} }
// 更新文档浏览时间
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: data.data.rootID});
const protyleOptions: IProtyleOptions = { const protyleOptions: IProtyleOptions = {
blockId: id, blockId: id,
rootId: data.data.rootID, rootId: data.data.rootID,
@ -77,6 +76,9 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
addLoading(window.siyuan.mobile.editor.protyle); addLoading(window.siyuan.mobile.editor.protyle);
if (window.siyuan.mobile.editor.protyle.block.rootID !== data.data.rootID) { if (window.siyuan.mobile.editor.protyle.block.rootID !== data.data.rootID) {
window.siyuan.mobile.editor.protyle.wysiwyg.element.innerHTML = ""; 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]) { if (action.includes(Constants.CB_GET_SCROLL) && window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID]) {
getDocByScroll({ getDocByScroll({
@ -109,6 +111,7 @@ export const openMobileFileById = (app: App, id: string, action: TProtyleAction[
} }
window.siyuan.mobile.editor.protyle.undo.clear(); window.siyuan.mobile.editor.protyle.undo.clear();
} else { } else {
fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: data.data.rootID});
window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions); window.siyuan.mobile.editor = new Protyle(app, document.getElementById("editor"), protyleOptions);
} }
setEditor(); setEditor();