This commit is contained in:
Vanessa 2022-12-04 17:27:56 +08:00
parent 6782c8fa30
commit 4629e15f57

View file

@ -681,12 +681,12 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
const btnsElement = saveDialog.element.querySelectorAll(".b3-button"); const btnsElement = saveDialog.element.querySelectorAll(".b3-button");
saveDialog.bindInput(saveDialog.element.querySelector("input"), () => { saveDialog.bindInput(saveDialog.element.querySelector("input"), () => {
btnsElement[1].dispatchEvent(new CustomEvent("click")); btnsElement[1].dispatchEvent(new CustomEvent("click"));
}) });
btnsElement[0].addEventListener("click", () => { btnsElement[0].addEventListener("click", () => {
saveDialog.destroy(); saveDialog.destroy();
}); });
btnsElement[1].addEventListener("click", () => { btnsElement[1].addEventListener("click", () => {
let criterion = config; const criterion = config;
criterion.name = saveDialog.element.querySelector("input").value; criterion.name = saveDialog.element.querySelector("input").value;
fetchPost("/api/storage/setCriterion", {criterion}, () => { fetchPost("/api/storage/setCriterion", {criterion}, () => {
saveDialog.destroy(); saveDialog.destroy();
@ -707,7 +707,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
menuElement.addEventListener("click", (event) => { menuElement.addEventListener("click", (event) => {
if (hasClosestByMatchTag(event.target as HTMLElement, "svg")) { if (hasClosestByMatchTag(event.target as HTMLElement, "svg")) {
fetchPost("/api/storage/removeCriterion", {name: item.name.trim()}); fetchPost("/api/storage/removeCriterion", {name: item.name.trim()});
window.siyuan.menus.menu.remove(); menuElement.remove();
return; return;
} }
if (config.layout !== item.layout) { if (config.layout !== item.layout) {
@ -763,7 +763,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
Object.assign(config, item); Object.assign(config, item);
inputEvent(element, config, undefined, edit); inputEvent(element, config, undefined, edit);
window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.remove();
}) });
} }
}); });
}); });