From c0b0e3f03e811e53af8ded5fb6032323f8027ef0 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 22 Jun 2024 17:21:28 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11791 --- app/src/ai/actions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts index 19622fdde..a906cb086 100644 --- a/app/src/ai/actions.ts +++ b/app/src/ai/actions.ts @@ -165,8 +165,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { focusByRange(protyle.toolbar.range); }); let customHTML = ""; - window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => { - customHTML += `
+ window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }, index: number) => { + customHTML += `
${escapeHtml(item.name)}
`; @@ -251,7 +251,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { let target = event.target as HTMLElement; while (target && !target.isSameNode(element)) { if (target.classList.contains("b3-list-item__action")) { - editDialog(target.previousElementSibling.textContent, target.parentElement.getAttribute("aria-label")); + const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index] + editDialog(subItem.name, subItem.memo); menu.close(); event.stopPropagation(); event.preventDefault();