diff --git a/app/src/business/openRecentDocs.ts b/app/src/business/openRecentDocs.ts
index 894ea04a5..5e1f421af 100644
--- a/app/src/business/openRecentDocs.ts
+++ b/app/src/business/openRecentDocs.ts
@@ -3,7 +3,7 @@ import {unicode2Emoji} from "../emoji";
import {Constants} from "../constants";
import {escapeHtml} from "../util/escape";
import {isWindow} from "../util/functions";
-import {updateHotkeyTip} from "../protyle/util/compatibility";
+import {setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
import {getAllDocks} from "../layout/getAll";
import {Dialog} from "../dialog";
import {focusByRange} from "../protyle/util/selection";
@@ -110,10 +110,10 @@ export const openRecentDocs = () => {
`,
@@ -187,6 +187,8 @@ export const openRecentDocs = () => {
getHTML(newResponse.data, dialog.element, searchElement.value, sortSelect.value as TRecentDocsSort);
});
}
+ window.siyuan.storage[Constants.LOCAL_RECENT_DOCS].type = sortSelect.value;
+ setStorageVal(Constants.LOCAL_RECENT_DOCS, window.siyuan.storage[Constants.LOCAL_RECENT_DOCS]);
});
getHTML(response.data, dialog.element);
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 048c7c92f..3e4e13c00 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -165,6 +165,7 @@ export abstract class Constants {
public static readonly LOCAL_IMAGES = "local-images";
public static readonly LOCAL_EMOJIS = "local-emojis";
public static readonly LOCAL_MOVE_PATH = "local-move-path";
+ public static readonly LOCAL_RECENT_DOCS = "local-recent-docs";
// dialog
public static readonly DIALOG_CONFIRM = "dialog-confirm";
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index df6a36693..ddc5ace6e 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -485,6 +485,7 @@ export const getLocalStorage = (cb: () => void) => {
};
defaultStorage[Constants.LOCAL_ZOOM] = 1;
defaultStorage[Constants.LOCAL_MOVE_PATH] = {keys: [], k: ""};
+ defaultStorage[Constants.LOCAL_RECENT_DOCS] = {type: "viewedAt"}; // TRecentDocsSort
[Constants.LOCAL_EXPORTIMG, Constants.LOCAL_SEARCHKEYS, Constants.LOCAL_PDFTHEME, Constants.LOCAL_BAZAAR,
Constants.LOCAL_EXPORTWORD, Constants.LOCAL_EXPORTPDF, Constants.LOCAL_DOCINFO, Constants.LOCAL_FONTSTYLES,
@@ -492,7 +493,7 @@ export const getLocalStorage = (cb: () => void) => {
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,
Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY,
Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS, Constants.LOCAL_IMAGES,
- Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH].forEach((key) => {
+ Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH, Constants.LOCAL_RECENT_DOCS].forEach((key) => {
if (typeof response.data[key] === "string") {
try {
const parseData = JSON.parse(response.data[key]);