Vanessa 2025-11-15 18:16:48 +08:00
parent 1debba9b14
commit 58e2bf4948
2 changed files with 9 additions and 8 deletions

View file

@ -33,7 +33,7 @@ export const openSearch = async (options: {
idPath = []; idPath = [];
} else { } else {
hPath = localData.hPath; hPath = localData.hPath;
idPath = localData.idPath; idPath = [...localData.idPath];
} }
} }
const config = { const config = {

View file

@ -523,6 +523,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
// ctrl+P 不需要保存 // ctrl+P 不需要保存
config.hasReplace = !config.hasReplace; config.hasReplace = !config.hasReplace;
element.querySelectorAll(".search__header")[1].classList.toggle("fn__none"); element.querySelectorAll(".search__header")[1].classList.toggle("fn__none");
element.querySelector("#criteria .b3-chip--current")?.classList.remove("b3-chip--current");
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
break; break;
@ -952,7 +953,7 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCo
if (dialogElement && dialogElement.getAttribute("data-key") === Constants.DIALOG_SEARCH) { if (dialogElement && dialogElement.getAttribute("data-key") === Constants.DIALOG_SEARCH) {
// https://github.com/siyuan-note/siyuan/issues/6828 // https://github.com/siyuan-note/siyuan/issues/6828
item.hPath = config.hPath; item.hPath = config.hPath;
item.idPath = config.idPath.join(",").split(","); item.idPath = [...config.idPath];
} }
if (config.hasReplace !== item.hasReplace) { if (config.hasReplace !== item.hasReplace) {
const replaceHeaderElement = element.querySelectorAll(".search__header")[1]; const replaceHeaderElement = element.querySelectorAll(".search__header")[1];
@ -979,11 +980,11 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCo
} }
let includeChild = true; let includeChild = true;
let enableIncludeChild = false; let enableIncludeChild = false;
item.idPath.forEach(item => { item.idPath.forEach(pathItem => {
if (item.endsWith(".sy")) { if (pathItem.endsWith(".sy")) {
includeChild = false; includeChild = false;
} }
if (item.split("/").length > 1) { if (pathItem.split("/").length > 1) {
enableIncludeChild = true; enableIncludeChild = true;
} }
}); });
@ -1003,8 +1004,8 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCo
} }
(element.querySelector("#replaceInput") as HTMLInputElement).value = item.r; (element.querySelector("#replaceInput") as HTMLInputElement).value = item.r;
element.querySelector("#searchSyntaxCheck").outerHTML = genQueryHTML(item.method, "searchSyntaxCheck"); element.querySelector("#searchSyntaxCheck").outerHTML = genQueryHTML(item.method, "searchSyntaxCheck");
Object.assign(config, item); config = JSON.parse(JSON.stringify(item));
window.siyuan.storage[Constants.LOCAL_SEARCHDATA] = Object.assign({}, config); window.siyuan.storage[Constants.LOCAL_SEARCHDATA] = JSON.parse(JSON.stringify(item));
setStorageVal(Constants.LOCAL_SEARCHDATA, window.siyuan.storage[Constants.LOCAL_SEARCHDATA]); setStorageVal(Constants.LOCAL_SEARCHDATA, window.siyuan.storage[Constants.LOCAL_SEARCHDATA]);
inputEvent(element, config, edit); inputEvent(element, config, edit);
window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.remove();