mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
ab9590d950
commit
bb3518b01e
2 changed files with 11 additions and 6 deletions
|
|
@ -375,7 +375,7 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH
|
|||
response.data.blocks.forEach((item: IBlock) => {
|
||||
let value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="d">${item.name || item.refText}</span>`;
|
||||
if (source === "search") {
|
||||
value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${key}</span>`;
|
||||
value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${key}${Constants.ZWSP}${item.name || item.refText}</span>`;
|
||||
}
|
||||
dataList.push({
|
||||
value,
|
||||
|
|
|
|||
|
|
@ -61,10 +61,9 @@ export class Hint {
|
|||
if (this.source !== "search") {
|
||||
this.fill(decodeURIComponent(btnElement.getAttribute("data-value")), protyle, true, isCtrl(event));
|
||||
} else {
|
||||
// 划选引用点击,需先重置 range
|
||||
setTimeout(() => {
|
||||
this.fill(decodeURIComponent(btnElement.getAttribute("data-value")), protyle);
|
||||
}, 148);
|
||||
this.fill(decodeURIComponent(btnElement.getAttribute("data-value")), protyle, true, !isCtrl(event));
|
||||
}, 148); // 划选引用点击,需先重置 range
|
||||
}
|
||||
focusByRange(protyle.toolbar.range);
|
||||
|
||||
|
|
@ -303,8 +302,8 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||
upDownHint(this.element.lastElementChild, event);
|
||||
if (event.key === "Enter") {
|
||||
setTimeout(() => {
|
||||
this.fill(decodeURIComponent(this.element.querySelector(".b3-list-item--focus").getAttribute("data-value")), protyle);
|
||||
}, 148);
|
||||
this.fill(decodeURIComponent(this.element.querySelector(".b3-list-item--focus").getAttribute("data-value")), protyle, true, !isCtrl(event));
|
||||
}, 148); // 划选引用点击,需先重置 range
|
||||
focusByRange(protyle.toolbar.range);
|
||||
event.preventDefault();
|
||||
} else if (event.key === "Escape") {
|
||||
|
|
@ -542,6 +541,12 @@ ${genHintItemHTML(item)}
|
|||
tempElement.setAttribute("data-subtype", "s");
|
||||
tempElement.innerText = staticText;
|
||||
}
|
||||
} else {
|
||||
tempElement.setAttribute("data-subtype", "d");
|
||||
const dynamicTexts = tempElement.innerText.split(Constants.ZWSP);
|
||||
if (dynamicTexts.length === 2) {
|
||||
tempElement.innerText = dynamicTexts[1];
|
||||
}
|
||||
}
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue