From a02c0a8a3aca143ac2a2d43be7522201872d2ae4 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 7 Apr 2024 17:04:26 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/10917 --- app/src/protyle/toolbar/index.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index b406336c5..806e5bdd2 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -1464,7 +1464,7 @@ export class Toolbar { } upDownHint(listElement, event); if (event.key === "Enter") { - hintRenderWidget(this.subElement.querySelector(".b3-list-item--focus").textContent, protyle); + hintRenderWidget(this.subElement.querySelector(".b3-list-item--focus").getAttribute("data-content"), protyle); this.subElement.classList.add("fn__none"); event.preventDefault(); } else if (event.key === "Escape") { @@ -1478,8 +1478,11 @@ export class Toolbar { k: inputElement.value, }, (response) => { let searchHTML = ""; - response.data.blocks.forEach((item: { path: string, content: string }, index: number) => { - searchHTML += `
${item.content}
`; + response.data.blocks.forEach((item: { path: string, content: string,name:string }, index: number) => { + searchHTML += `
+ ${item.name} + ${item.content} +
`; }); listElement.innerHTML = searchHTML; }); @@ -1490,7 +1493,7 @@ export class Toolbar { if (!listElement) { return; } - hintRenderWidget(listElement.textContent, protyle); + hintRenderWidget(listElement.dataset.content, protyle); }); this.subElement.style.zIndex = (++window.siyuan.zIndex).toString(); this.subElement.classList.remove("fn__none"); @@ -1501,8 +1504,11 @@ export class Toolbar { k: "", }, (response) => { let html = ""; - response.data.blocks.forEach((item: { content: string }, index: number) => { - html += `
${item.content}
`; + response.data.blocks.forEach((item: { content: string, name: string }, index: number) => { + html += `
+${item.name} +${item.content} +
`; }); this.subElement.querySelector(".b3-list--background").innerHTML = html; /// #if !MOBILE