Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14269

Vanessa698586bd4d5d
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index 62733d67dc..67413197b6 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -415,10 +415,14 @@ export const genHintItemHTML = (item: IBlock) => {
if (attrHTML) {
attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
-
- return `${attrHTML}<div class="b3-list-item__first">
+ let countHTML = '';
+ if (item.refCount) {
+ countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.ref}">${item.refCount}</span>`;
+ }
+ // data-node-id 用于获取引用面板
+ return `${attrHTML}<div class="b3-list-item__first" data-node-id="${item.id}">
${iconHTML}
- <span class="b3-list-item__text">${item.content}</span>
+ <span class="b3-list-item__text">${item.content}</span>${countHTML}
</div>
<div class="b3-list-item__meta b3-list-item__showall">${item.hPath}</div>`;
};
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 113d156fc1..7d44e539eb 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -1324,6 +1324,7 @@ const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: Confi
let newData;
data.forEach((item) => {
const title = getNotebookName(item.box) + getDisplayName(item.hPath, false);
+ let countHTML = '';
if (item.children) {
resultHTML += `<div class="b3-list-item">
<span class="b3-list-item__toggle b3-list-item__toggle--hl">
@@ -1341,12 +1342,16 @@ ${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOC
newData = childItem;
}
}
+ if (childItem.refCount) {
+ countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.ref}">${childItem.refCount}</span>`;
+ }
resultHTML += `<div style="padding-left: 36px" data-type="search-item" class="b3-list-item" data-node-id="${childItem.id}" data-root-id="${childItem.rootID}">
<svg class="b3-list-item__graphic popover__block" data-id="${childItem.id}"><use xlink:href="#${getIconByType(childItem.type)}"></use></svg>
${unicode2Emoji(childItem.ial.icon, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${childItem.content}</span>
${getAttr(childItem)}
${childItem.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis">${childItem.tag.replace(/#/g, "")}</span>` : ""}
+${countHTML}
</div>`;
});
resultHTML += "</div>";
@@ -1359,6 +1364,9 @@ ${childItem.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis"
newData = item;
}
}
+ if (item.refCount) {
+ countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.ref}">${item.refCount}</span>`;
+ }
resultHTML += `<div data-type="search-item" class="b3-list-item" data-node-id="${item.id}" data-root-id="${item.rootID}">
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type)}"></use></svg>
${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
@@ -1366,6 +1374,7 @@ ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
${getAttr(item)}
${item.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis">${item.tag.replace(/#/g, "")}</span>` : ""}
<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>
+${countHTML}
</div>`;
}
});
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 1020058d52..498a3b6d20 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -772,6 +772,7 @@ interface IBlock {
children?: IBlock[]
length?: number
ial: IObject
+ refCount?: number
}
interface IRiffCard {