diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 692066e19..645a5f302 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -542,6 +542,11 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: () inputTimeout = inputEvent(element, config, inputTimeout, edit, event); }); searchInputElement.addEventListener("blur", () => { + if (config.removed) { + config.k = searchInputElement.value; + window.siyuan.storage[Constants.LOCAL_SEARCHDATA] = Object.assign({}, config); + setStorageVal(Constants.LOCAL_SEARCHDATA, window.siyuan.storage[Constants.LOCAL_SEARCHDATA]); + } saveKeyList("keys", searchInputElement.value); }); searchInputElement.addEventListener("keydown", (event: KeyboardEvent) => { @@ -825,6 +830,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element: } return; } + config.removed = false; updateConfig(element, item, config, edit); }); } @@ -841,6 +847,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element: label: window.siyuan.languages.removeCriterion, click() { updateConfig(element, { + removed: true, sort: 0, group: 0, hasReplace: false, diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index dc421ffae..634d50f78 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -81,6 +81,7 @@ interface ICard { } interface ISearchOption { + removed?: boolean // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745 name?: string sort: number, // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序 group: number, // 0:不分组,1:按文档分组