diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 0b16002f9..5cf2ac8bc 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -440,6 +440,12 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH let value = `${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}`; if (source === "search") { value = `${key}${Constants.ZWSP}${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}`; + } else if (source === "av") { + let refText = item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "") + if (nodeElement) { + refText = item.ial['custom-sy-av-s-text-' + nodeElement.getAttribute("data-av-id")] || refText; + } + value = `${refText}`; } dataList.push({ value, diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 0da7e85ea..1a977f58e 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -339,7 +339,11 @@ ${unicode2Emoji(emoji.unicode)}`; let blockRefHTML; if (source === "av") { // av 搜索时需要获取值 https://github.com/siyuan-note/siyuan/issues/12020 - blockRefHTML = `${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}`; + let refText = item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "") + if (nodeElement) { + refText = item.ial['custom-sy-av-s-text-' + nodeElement.getAttribute("data-av-id")] || refText; + } + blockRefHTML = `${refText}`; } else { blockRefHTML = `${oldValue}`; } diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 705c0771c..a1f7270a5 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -329,7 +329,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi id: "copyBlockRef", iconHTML: "", label: window.siyuan.languages.copyBlockRef, - click: async () => { + click: () => { let text = ""; for (let i = 0; i < ids.length; i++) { const id = ids[i]; @@ -338,8 +338,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi if (cellElement.getAttribute("data-detached") === "true") { content = cellElement.querySelector(".av__celltext").textContent; } else { - const response = await fetchSyncPost("/api/block/getRefText", {id}); - content = `((${id} '${response.data}'))`; + content = `((${id} '${cellElement.querySelector(".av__celltext").textContent}'))`; } if (ids.length > 1) { text += "* "; @@ -399,7 +398,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi id: "copyProtocolInMd", iconHTML: "", label: window.siyuan.languages.copyProtocolInMd, - click: async () => { + click: () => { let text = ""; for (let i = 0; i < ids.length; i++) { const id = ids[i]; @@ -408,8 +407,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi if (cellElement.getAttribute("data-detached") === "true") { content = cellElement.querySelector(".av__celltext").textContent; } else { - const response = await fetchSyncPost("/api/block/getRefText", {id}); - content = `[${response.data}](siyuan://blocks/${id})`; + content = `[${cellElement.querySelector(".av__celltext").textContent}](siyuan://blocks/${id})`; } if (ids.length > 1) { text += "* ";