🎨 Backlink count at the doc block title including sub-blocks https://github.com/siyuan-note/siyuan/issues/13791

This commit is contained in:
Daniel 2025-01-12 16:45:17 +08:00
parent 91ee1ccf0b
commit 3ebcf5fcb9
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -173,10 +173,7 @@ export const setDefRefCount = (data: {
rootRefIDs: string[] rootRefIDs: string[]
}) => { }) => {
getAllEditor().forEach(editor => { getAllEditor().forEach(editor => {
if (editor.protyle.block.rootID === data.rootID) { if (editor.protyle.block.rootID === data.rootID && editor.protyle.title) {
if (!editor.protyle.title) {
return;
}
const attrElement = editor.protyle.title.element.querySelector(".protyle-attr"); const attrElement = editor.protyle.title.element.querySelector(".protyle-attr");
const countElement = attrElement.querySelector(".protyle-attr--refcount"); const countElement = attrElement.querySelector(".protyle-attr--refcount");
if (countElement) { if (countElement) {
@ -189,7 +186,6 @@ export const setDefRefCount = (data: {
} else if (data.rootRefCount > 0) { } else if (data.rootRefCount > 0) {
attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids="[&quot;${data.rootID}&quot;]" data-id="${JSON.stringify(data.rootRefIDs)}" style="">${data.rootRefCount}</div>`); attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids="[&quot;${data.rootID}&quot;]" data-id="${JSON.stringify(data.rootRefIDs)}" style="">${data.rootRefCount}</div>`);
} }
return;
} }
if (data.rootID === data.blockID) { if (data.rootID === data.blockID) {
return; return;