🎨 Add statistics on selected blocks and total blocks https://github.com/siyuan-note/siyuan/issues/13235
This commit is contained in:
parent
adb942b4d5
commit
14bb85017f
15 changed files with 33 additions and 7 deletions
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Links",
|
||||
"imgCount": "Bilder",
|
||||
"refCount": "Referenzen",
|
||||
"blockCount": "Blöcke",
|
||||
"kbd": "Tastatur",
|
||||
"errorStyle": "Fehlerstil",
|
||||
"successStyle": "Erfolg-Stil",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Links",
|
||||
"imgCount": "Images",
|
||||
"refCount": "Refs",
|
||||
"blockCount": "Blocks",
|
||||
"kbd": "Keyboard",
|
||||
"errorStyle": "Error Style",
|
||||
"successStyle": "Success Style",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Enlaces",
|
||||
"imgCount": "Imágenes",
|
||||
"refCount": "Referencias",
|
||||
"blockCount": "Bloques",
|
||||
"kbd": "Teclado",
|
||||
"errorStyle": "Estilo de error",
|
||||
"successStyle": "Estilo de éxito",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Liens",
|
||||
"imgCount": "Images",
|
||||
"refCount": "Réfs",
|
||||
"blockCount": "Blocs",
|
||||
"kbd": "Clavier",
|
||||
"errorStyle": "Style d'Erreur",
|
||||
"successStyle": "Style de Réussite",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "קישורים",
|
||||
"imgCount": "תמונות",
|
||||
"refCount": "יחוסים",
|
||||
"blockCount": "בלוקים",
|
||||
"kbd": "מקלדת",
|
||||
"errorStyle": "סגנון שגיאה",
|
||||
"successStyle": "סגנון הצלחה",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Link",
|
||||
"imgCount": "Immagini",
|
||||
"refCount": "Riferimenti",
|
||||
"blockCount": "Blocchi",
|
||||
"kbd": "Tastiera",
|
||||
"errorStyle": "Stile Errore",
|
||||
"successStyle": "Stile Successo",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "リンク数",
|
||||
"imgCount": "画像数",
|
||||
"refCount": "参照数",
|
||||
"blockCount": "ブロック",
|
||||
"kbd": "キーボード",
|
||||
"errorStyle": "エラースタイル",
|
||||
"successStyle": "成功スタイル",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Linki",
|
||||
"imgCount": "Obrazy",
|
||||
"refCount": "Refs",
|
||||
"blockCount": "bloki",
|
||||
"kbd": "Klawiatura",
|
||||
"errorStyle": "Styl błędu",
|
||||
"successStyle": "Styl sukcesu",
|
||||
|
|
|
@ -805,6 +805,7 @@
|
|||
"linkCount": "Ссылки",
|
||||
"imgCount": "Изображения",
|
||||
"refCount": "Ссылки",
|
||||
"blockCount": "блоки",
|
||||
"kbd": "Клавиатура",
|
||||
"errorStyle": "Стиль ошибки",
|
||||
"successStyle": "Стиль успеха",
|
||||
|
|
|
@ -800,11 +800,12 @@
|
|||
"vLayout": "垂直佈局",
|
||||
"hLayout": "水平佈局",
|
||||
"merge": "合併",
|
||||
"wordCount": "字數",
|
||||
"runeCount": "字符數",
|
||||
"wordCount": "字",
|
||||
"runeCount": "字符",
|
||||
"linkCount": "連結",
|
||||
"imgCount": "圖片",
|
||||
"refCount": "引用",
|
||||
"blockCount": "塊",
|
||||
"kbd": "鍵盤",
|
||||
"errorStyle": "錯誤樣式",
|
||||
"successStyle": "成功樣式",
|
||||
|
|
|
@ -800,11 +800,12 @@
|
|||
"vLayout": "垂直布局",
|
||||
"hLayout": "水平布局",
|
||||
"merge": "合并",
|
||||
"wordCount": "字数",
|
||||
"runeCount": "字符数",
|
||||
"wordCount": "字",
|
||||
"runeCount": "字符",
|
||||
"linkCount": "链接",
|
||||
"imgCount": "图片",
|
||||
"refCount": "引用",
|
||||
"blockCount": "块",
|
||||
"kbd": "键盘",
|
||||
"errorStyle": "错误样式",
|
||||
"successStyle": "成功样式",
|
||||
|
|
|
@ -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> ${stat.refCount}<span class="fn__space"></span>`;
|
||||
}if (0 < stat.blockCount) {
|
||||
html += `<span class="ft__on-surface">${window.siyuan.languages.blockCount}</span> ${stat.blockCount}<span class="fn__space"></span>`;
|
||||
}
|
||||
document.querySelector("#status .status__counter").innerHTML = html;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -480,6 +480,7 @@ func BlocksWordCount(ids []string) (ret *util.BlockStatResult) {
|
|||
ret.ImageCount += imgCnt
|
||||
ret.RefCount += refCnt
|
||||
}
|
||||
ret.BlockCount = len(ids)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -491,9 +492,18 @@ func StatTree(id string) (ret *util.BlockStatResult) {
|
|||
return
|
||||
}
|
||||
|
||||
blockCount := 0
|
||||
var databaseBlockNodes []*ast.Node
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || ast.NodeAttributeView != n.Type {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if n.IsBlock() {
|
||||
blockCount++
|
||||
}
|
||||
|
||||
if ast.NodeAttributeView != n.Type {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
|
@ -585,6 +595,7 @@ func StatTree(id string) (ret *util.BlockStatResult) {
|
|||
LinkCount: linkCnt,
|
||||
ImageCount: imgCnt,
|
||||
RefCount: refCnt,
|
||||
BlockCount: blockCount,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ type BlockStatResult struct {
|
|||
LinkCount int `json:"linkCount"`
|
||||
ImageCount int `json:"imageCount"`
|
||||
RefCount int `json:"refCount"`
|
||||
BlockCount int `json:"blockCount"`
|
||||
}
|
||||
|
||||
func ContextPushMsg(context map[string]interface{}, msg string) {
|
||||
|
|
Loading…
Add table
Reference in a new issue