diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts index 48f84cc57..85447fbe8 100644 --- a/app/src/menus/Menu.ts +++ b/app/src/menus/Menu.ts @@ -124,8 +124,6 @@ export class MenuItem { return; } options.click(this.element); - this.element.parentElement.classList.add("fn__none"); - this.element.parentElement.innerHTML = ""; event.preventDefault(); event.stopImmediatePropagation(); event.stopPropagation(); diff --git a/app/src/search/util.ts b/app/src/search/util.ts index a36726a88..78d80b0eb 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -17,7 +17,7 @@ import {addLoading, setPadding} from "../protyle/ui/initUI"; import {getIconByType} from "../editor/getIcon"; import {unicode2Emoji} from "../emoji"; import {Dialog} from "../dialog"; -import {hasClosestByMatchTag} from "../protyle/util/hasClosest"; +import {hasClosestByClassName} from "../protyle/util/hasClosest"; export const openGlobalSearch = (text: string, replace: boolean) => { text = text.trim(); @@ -720,7 +720,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element: `, bind(menuElement) { menuElement.addEventListener("click", (event) => { - if (hasClosestByMatchTag(event.target as HTMLElement, "svg")) { + if (hasClosestByClassName(event.target as HTMLElement, "fn__a")) { fetchPost("/api/storage/removeCriterion", {name: item.name.trim()}); event.preventDefault(); event.stopPropagation(); @@ -731,6 +731,12 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element: } return; } + const dialogElement = hasClosestByClassName(element, "b3-dialog--open") + if (dialogElement && dialogElement.getAttribute("data-key") === window.siyuan.config.keymap.general.search.custom) { + // https://github.com/siyuan-note/siyuan/issues/6828 + item.hPath = config.hPath; + item.idPath = config.idPath.join(",").split(","); + } if (config.layout !== item.layout) { if (item.layout === 0) { element.querySelector(".search__layout").classList.remove("search__layout--row");