🎨 Add statistics on selected blocks and total blocks https://github.com/siyuan-note/siyuan/issues/13235

This commit is contained in:
Daniel 2024-11-23 20:57:17 +08:00
parent adb942b4d5
commit 14bb85017f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 33 additions and 7 deletions

View file

@ -194,7 +194,8 @@ export const renderStatusbarCounter = (stat: {
wordCount: number,
linkCount: number,
imageCount: number,
refCount: number
refCount: number,
blockCount: number,
}) => {
if (!stat) {
return;
@ -209,6 +210,8 @@ export const renderStatusbarCounter = (stat: {
}
if (0 < stat.refCount) {
html += `<span class="ft__on-surface">${window.siyuan.languages.refCount}</span>&nbsp;${stat.refCount}<span class="fn__space"></span>`;
}if (0 < stat.blockCount) {
html += `<span class="ft__on-surface">${window.siyuan.languages.blockCount}</span>&nbsp;${stat.blockCount}<span class="fn__space"></span>`;
}
document.querySelector("#status .status__counter").innerHTML = html;
};

View file

@ -576,7 +576,7 @@ ${padHTML}
iconHTML: "",
type: "readonly",
// 不能换行,否则移动端间距过大
label: `<div class="fn__flex">${window.siyuan.languages.runeCount}<span class="fn__space fn__flex-1"></span>${response.data.runeCount}</div><div class="fn__flex">${window.siyuan.languages.wordCount}<span class="fn__space fn__flex-1"></span>${response.data.wordCount}</div><div class="fn__flex">${window.siyuan.languages.linkCount}<span class="fn__space fn__flex-1"></span>${response.data.linkCount}</div><div class="fn__flex">${window.siyuan.languages.imgCount}<span class="fn__space fn__flex-1"></span>${response.data.imageCount}</div><div class="fn__flex">${window.siyuan.languages.refCount}<span class="fn__space fn__flex-1"></span>${response.data.refCount}</div>`,
label: `<div class="fn__flex">${window.siyuan.languages.runeCount}<span class="fn__space fn__flex-1"></span>${response.data.runeCount}</div><div class="fn__flex">${window.siyuan.languages.wordCount}<span class="fn__space fn__flex-1"></span>${response.data.wordCount}</div><div class="fn__flex">${window.siyuan.languages.linkCount}<span class="fn__space fn__flex-1"></span>${response.data.linkCount}</div><div class="fn__flex">${window.siyuan.languages.imgCount}<span class="fn__space fn__flex-1"></span>${response.data.imageCount}</div><div class="fn__flex">${window.siyuan.languages.refCount}<span class="fn__space fn__flex-1"></span>${response.data.refCount}</div><div class="fn__flex">${window.siyuan.languages.blockCount}<span class="fn__space fn__flex-1"></span>${response.data.blockCount}</div>`,
}).element);
/// #if MOBILE
window.siyuan.menus.menu.fullscreen();