mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
This commit is contained in:
parent
5b3fa67332
commit
190fa7f8c4
3 changed files with 15 additions and 7 deletions
|
|
@ -440,6 +440,12 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH
|
|||
let value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="d">${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
|
||||
if (source === "search") {
|
||||
value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${key}${Constants.ZWSP}${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
|
||||
} 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 = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${refText}</span>`;
|
||||
}
|
||||
dataList.push({
|
||||
value,
|
||||
|
|
|
|||
|
|
@ -339,7 +339,11 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||
let blockRefHTML;
|
||||
if (source === "av") {
|
||||
// av 搜索时需要获取值 https://github.com/siyuan-note/siyuan/issues/12020
|
||||
blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${item.name || item.refText.replace(new RegExp(Constants.ZWSP, "g"), "")}</span>`;
|
||||
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 = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${refText}</span>`;
|
||||
} else {
|
||||
blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 += "* ";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue