This commit is contained in:
Vanessa 2023-03-22 19:18:23 +08:00
parent 4cdc96eca7
commit fd38d4e1f0
2 changed files with 8 additions and 0 deletions

View file

@ -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,

View file

@ -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按文档分组