Vanessa 2024-03-31 09:39:46 +08:00
parent c80ceb67b8
commit 487e2f980b
2 changed files with 9 additions and 9 deletions

View file

@ -47,13 +47,13 @@ const editDialog = (customName: string, customMemo: string) => {
const customElement = dialog.element.querySelector("textarea");
const btnsElement = dialog.element.querySelectorAll(".b3-button");
dialog.bindInput(customElement, () => {
(btnsElement[1] as HTMLButtonElement).click();
(btnsElement[2] as HTMLButtonElement).click();
});
customElement.value = customMemo;
btnsElement[0].addEventListener("click", () => {
btnsElement[1].addEventListener("click", () => {
dialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
btnsElement[2].addEventListener("click", () => {
window.siyuan.storage[Constants.LOCAL_AI].find((subItem: {
name: string,
memo: string
@ -67,7 +67,7 @@ const editDialog = (customName: string, customMemo: string) => {
});
dialog.destroy();
});
btnsElement[2].addEventListener("click", () => {
btnsElement[0].addEventListener("click", () => {
window.siyuan.storage[Constants.LOCAL_AI].find((subItem: {
name: string,
memo: string

View file

@ -46,12 +46,12 @@ const editLayout = (layoutName?: string) => {
inputElement.select();
inputElement.focus();
dialog.bindInput(inputElement, () => {
btnsElement[1].dispatchEvent(new CustomEvent("click"));
});
btnsElement[0].addEventListener("click", () => {
dialog.destroy();
btnsElement[2].dispatchEvent(new CustomEvent("click"));
});
btnsElement[1].addEventListener("click", () => {
dialog.destroy();
});
btnsElement[2].addEventListener("click", () => {
const value = inputElement.value;
if (!value) {
showMessage(window.siyuan.languages["_kernel"]["142"]);
@ -88,7 +88,7 @@ const editLayout = (layoutName?: string) => {
});
setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);
});
btnsElement[2].addEventListener("click", () => {
btnsElement[0].addEventListener("click", () => {
window.siyuan.storage[Constants.LOCAL_LAYOUTS].find((layoutItem: ISaveLayout, index: number) => {
if (layoutItem.name === layoutName) {
window.siyuan.storage[Constants.LOCAL_LAYOUTS].splice(index, 1);