Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 authored and tom2319273 committed Aug 3, 2024
1 parent dfcca13 commit d1aa788
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/ai/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 += `<div data-action="${item.memo || item.name}" class="b3-list-item b3-list-item--narrow ariaLabel" aria-label="${escapeAriaLabel(item.memo)}">
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }, index: number) => {
customHTML += `<div data-action="${item.memo || item.name}" data-index="${index}" class="b3-list-item b3-list-item--narrow ariaLabel" aria-label="${escapeAriaLabel(item.memo)}">
<span class="b3-list-item__text">${escapeHtml(item.name)}</span>
<span data-type="edit" class="b3-list-item__action"><svg><use xlink:href="#iconEdit"></use></svg></span>
</div>`;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d1aa788

Please sign in to comment.