diff --git a/app/src/constants.ts b/app/src/constants.ts
index 6f2241e1d..9cfc237f6 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -65,10 +65,10 @@ export abstract class Constants {
// localstorage
public static readonly LOCAL_ZOOM = "local-zoom";
- public static readonly LOCAL_SEARCHEDATA = "local-searchedata";
- public static readonly LOCAL_SEARCHEKEYS = "local-searchekeys";
+ public static readonly LOCAL_SEARCHDATA = "local-searchdata";
+ public static readonly LOCAL_SEARCHKEYS = "local-searchkeys";
+ public static readonly LOCAL_SEARCHKEY = "local-searchkey"; // only mobile
public static readonly LOCAL_DOCINFO = "local-docinfo"; // only mobile
- public static readonly LOCAL_SEARCHEKEY = "local-searchkey"; // only mobile
public static readonly LOCAL_DAILYNOTEID = "local-dailynoteid"; // string
public static readonly LOCAL_HISTORYNOTEID = "local-historynoteid"; // string
public static readonly LOCAL_CODELANG = "local-codelang"; // string
diff --git a/app/src/mobile/util/search.ts b/app/src/mobile/util/search.ts
index 10cad3ce8..6c844098f 100644
--- a/app/src/mobile/util/search.ts
+++ b/app/src/mobile/util/search.ts
@@ -38,15 +38,15 @@ export const toolbarSearchEvent = () => {
onRecentBlocks(response.data.blocks, response.data.matchedRootCount,response.data.matchedBlockCount);
});
}
- window.siyuan.storage[Constants.LOCAL_SEARCHEKEY] = inputElement.value;
- setStorageVal(Constants.LOCAL_SEARCHEKEY, window.siyuan.storage[Constants.LOCAL_SEARCHEKEY]);
+ window.siyuan.storage[Constants.LOCAL_SEARCHKEY] = inputElement.value;
+ setStorageVal(Constants.LOCAL_SEARCHKEY, window.siyuan.storage[Constants.LOCAL_SEARCHKEY]);
}, Constants.TIMEOUT_SEARCH);
};
const initToolbarSearch = () => {
const inputElement = document.getElementById("toolbarSearch") as HTMLInputElement;
inputElement.focus();
- inputElement.value = window.siyuan.storage[Constants.LOCAL_SEARCHEKEY] || "";
+ inputElement.value = window.siyuan.storage[Constants.LOCAL_SEARCHKEY] || "";
inputElement.addEventListener("compositionend", (event: InputEvent) => {
if (event && event.isComposing) {
return;
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 5ddae370d..25b60f395 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -144,7 +144,7 @@ export const getLocalStorage = (cb: () => void) => {
window.siyuan.storage = response.data;
// 历史数据迁移
const defaultStorage: any = {};
- defaultStorage[Constants.LOCAL_SEARCHEKEYS] = {
+ defaultStorage[Constants.LOCAL_SEARCHKEYS] = {
keys: [],
replaceKeys: [],
col: "",
@@ -180,7 +180,7 @@ export const getLocalStorage = (cb: () => void) => {
action: []
};
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
- defaultStorage[Constants.LOCAL_SEARCHEDATA] = {
+ defaultStorage[Constants.LOCAL_SEARCHDATA] = {
sort: 0,
group: 0,
hasReplace: false,
@@ -205,16 +205,16 @@ export const getLocalStorage = (cb: () => void) => {
}
};
defaultStorage[Constants.LOCAL_ZOOM] = 1;
- defaultStorage[Constants.LOCAL_SEARCHEKEY] = "";
+ defaultStorage[Constants.LOCAL_SEARCHKEY] = "";
- [Constants.LOCAL_EXPORTIMG, Constants.LOCAL_SEARCHEKEYS, Constants.LOCAL_PDFTHEME, Constants.LOCAL_BAZAAR, Constants.LOCAL_EXPORTWORD,
- Constants.LOCAL_EXPORTPDF, Constants.LOCAL_DOCINFO, Constants.LOCAL_FONTSTYLES, Constants.LOCAL_SEARCHEDATA,
- Constants.LOCAL_ZOOM, Constants.LOCAL_SEARCHEKEY, Constants.LOCAL_LAYOUTS].forEach((key) => {
+ [Constants.LOCAL_EXPORTIMG, Constants.LOCAL_SEARCHKEYS, Constants.LOCAL_PDFTHEME, Constants.LOCAL_BAZAAR, Constants.LOCAL_EXPORTWORD,
+ Constants.LOCAL_EXPORTPDF, Constants.LOCAL_DOCINFO, Constants.LOCAL_FONTSTYLES, Constants.LOCAL_SEARCHDATA,
+ Constants.LOCAL_ZOOM, Constants.LOCAL_SEARCHKEY, Constants.LOCAL_LAYOUTS].forEach((key) => {
if (typeof response.data[key] === "string") {
try {
window.siyuan.storage[key] = Object.assign(defaultStorage[key], JSON.parse(response.data[key]));
} catch (e) {
- window.siyuan.storage[key] = key === Constants.LOCAL_SEARCHEKEY ? (response.data[key] || "") : defaultStorage[key];
+ window.siyuan.storage[key] = key === Constants.LOCAL_SEARCHKEY ? (response.data[key] || "") : defaultStorage[key];
}
} else if (typeof response.data[key] === "undefined") {
window.siyuan.storage[key] = defaultStorage[key];
diff --git a/app/src/search/spread.ts b/app/src/search/spread.ts
index 503e8a74f..e1d738d3c 100644
--- a/app/src/search/spread.ts
+++ b/app/src/search/spread.ts
@@ -45,7 +45,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
if (exitDialog) {
return;
}
- const localData = window.siyuan.storage[Constants.LOCAL_SEARCHEDATA];
+ const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
let hPath = "";
let idPath: string[] = [];
if (notebookId) {
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index a5f472bbd..b58cebb4c 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -21,15 +21,15 @@ import {hasClosestByClassName} from "../protyle/util/hasClosest";
import {setStorageVal} from "../protyle/util/compatibility";
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
- let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHEKEYS][type];
+ let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type];
list.splice(0, 0, value);
list = Array.from(new Set(list));
if (list.length > window.siyuan.config.search.limit) {
list.splice(window.siyuan.config.search.limit, list.length - window.siyuan.config.search.limit);
}
// new Set 后需重新赋值
- window.siyuan.storage[Constants.LOCAL_SEARCHEKEYS][type] = list;
- setStorageVal(Constants.LOCAL_SEARCHEKEYS, window.siyuan.storage[Constants.LOCAL_SEARCHEKEYS]);
+ window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type] = list;
+ setStorageVal(Constants.LOCAL_SEARCHKEYS, window.siyuan.storage[Constants.LOCAL_SEARCHKEYS]);
};
export const openGlobalSearch = (text: string, replace: boolean) => {
@@ -53,7 +53,7 @@ export const openGlobalSearch = (text: string, replace: boolean) => {
icon: "iconSearch",
title: window.siyuan.languages.search,
callback(tab) {
- const localData = window.siyuan.storage[Constants.LOCAL_SEARCHEDATA];
+ const localData = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
const asset = new Search({
tab,
config: {
@@ -95,7 +95,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
enableIncludeChild = true;
}
});
- const data = window.siyuan.storage[Constants.LOCAL_SEARCHEKEYS];
+ const data = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS];
element.innerHTML = `