From 310c9b844c4430c5fae84a0e0d72e299adf36be3 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 13 Jan 2025 18:05:19 +0800 Subject: [PATCH 1/4] :art: Backlink count at the doc block title including sub-blocks https://github.com/siyuan-note/siyuan/issues/13791 --- kernel/model/push_reload.go | 5 +++-- kernel/sql/block_ref_query.go | 2 +- kernel/util/websocket.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/model/push_reload.go b/kernel/model/push_reload.go index a010ee1d4..c1cdd274d 100644 --- a/kernel/model/push_reload.go +++ b/kernel/model/push_reload.go @@ -154,8 +154,9 @@ func refreshRefCount(rootID, blockID string) { isDoc := bt.ID == bt.RootID var rootRefIDs []string var refCount, rootRefCount int - refIDs := sql.QueryRefIDsByDefID(bt.ID, isDoc) + var refIDs []string if isDoc { + refIDs = sql.QueryRefIDsByDefID(bt.ID, isDoc) rootRefIDs = refIDs } else { rootRefIDs = sql.QueryRefIDsByDefID(bt.RootID, true) @@ -169,7 +170,7 @@ func refreshRefCount(rootID, blockID string) { defIDs = append(defIDs, bt.ID) } - util.PushSetDefRefCount(rootID, blockID, refIDs, rootRefIDs, defIDs, refCount, rootRefCount) + util.PushSetDefRefCount(rootID, blockID, defIDs, refCount, rootRefCount) } // refreshDynamicRefText 用于刷新块引用的动态锚文本。 diff --git a/kernel/sql/block_ref_query.go b/kernel/sql/block_ref_query.go index 6f15b9f7d..f786b8288 100644 --- a/kernel/sql/block_ref_query.go +++ b/kernel/sql/block_ref_query.go @@ -141,7 +141,7 @@ func QueryRootChildrenRefCount(defRootID string) (ret map[string]int) { func QueryRootBlockRefCount() (ret map[string]int) { ret = map[string]int{} - rows, err := query("SELECT def_block_root_id, COUNT(*) AS ref_cnt FROM refs GROUP BY def_block_root_id") + rows, err := query("SELECT def_block_root_id, COUNT(DISTINCT block_id) AS ref_cnt FROM refs GROUP BY def_block_root_id") if err != nil { logging.LogErrorf("sql query failed: %s", err) return diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go index 2bce8851c..954c427ed 100644 --- a/kernel/util/websocket.go +++ b/kernel/util/websocket.go @@ -271,8 +271,8 @@ func PushSetRefDynamicText(rootID, blockID, defBlockID, refText string) { BroadcastByType("main", "setRefDynamicText", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText}) } -func PushSetDefRefCount(rootID, blockID string, refIDs, rootRefIDs, defIDs []string, refCount, rootRefCount int) { - BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount, "refIDs": refIDs, "rootRefIDs": rootRefIDs, "defIDs": defIDs}) +func PushSetDefRefCount(rootID, blockID string, defIDs []string, refCount, rootRefCount int) { + BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount, "defIDs": defIDs}) } func PushProtyleLoading(rootID, msg string) { From 4325228196fc6fb50b070e357f7534394d2c6460 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:20:04 +0800 Subject: [PATCH 2/4] :art: Improve text * fix(hint): https://github.com/siyuan-note/siyuan/issues/13802 * fix(hint): https://github.com/siyuan-note/siyuan/issues/13802 --- app/appearance/langs/ar_SA.json | 2 +- app/appearance/langs/de_DE.json | 2 +- app/appearance/langs/en_US.json | 2 +- app/appearance/langs/es_ES.json | 2 +- app/appearance/langs/fr_FR.json | 2 +- app/appearance/langs/he_IL.json | 2 +- app/appearance/langs/it_IT.json | 2 +- app/appearance/langs/pl_PL.json | 2 +- app/appearance/langs/ru_RU.json | 2 +- app/appearance/langs/zh_CHT.json | 2 +- app/src/protyle/hint/extend.ts | 104 +++++++++++++++---------------- 11 files changed, 62 insertions(+), 62 deletions(-) diff --git a/app/appearance/langs/ar_SA.json b/app/appearance/langs/ar_SA.json index b11f04359..dc36a7cd2 100644 --- a/app/appearance/langs/ar_SA.json +++ b/app/appearance/langs/ar_SA.json @@ -831,7 +831,7 @@ "turnInto": "تحويل إلى", "split": "تقسيم", "underline": "خط سفلي", - "inline-math": "رياضيات داخل السطر", + "inline-math": "صيغة مضمنة", "moveToUp": "تحريك للأعلى", "moveToDown": "تحريك للأسفل", "moveToLeft": "تحريك لليسار", diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.json index 38850a0b1..b1f55e1ea 100644 --- a/app/appearance/langs/de_DE.json +++ b/app/appearance/langs/de_DE.json @@ -831,7 +831,7 @@ "turnInto": "Umwandeln in", "split": "Teilen", "underline": "Unterstreichen", - "inline-math": "Inline-Mathematik", + "inline-math": "Inline-Formel", "moveToUp": "Nach oben bewegen", "moveToDown": "Nach unten bewegen", "moveToLeft": "Nach links bewegen", diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 0fdd7effb..ffd5655e2 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -831,7 +831,7 @@ "turnInto": "Turn into", "split": "Split", "underline": "Underline", - "inline-math": "Inline Math", + "inline-math": "Inline Formula", "moveToUp": "Move Up", "moveToDown": "Move Down", "moveToLeft": "Move Left", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 8a8bd14bc..7f8719d7b 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -831,7 +831,7 @@ "turnInto": "Convertir en", "split": "Dividir", "underline": "Subrayar", - "inline-math": "Matemáticas en línea", + "inline-math": "Fórmula en línea", "moveToUp": "Desplazar arriba", "moveToDown": "Desplazar abajo", "moveToLeft": "Mover a la izquierda", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 0f6fcbcd2..1af4ab57b 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -831,7 +831,7 @@ "turnInto": "Convertir en", "split": "Divisé", "underline": "Souligner", - "inline-math": "Inline Math", + "inline-math": "Formule en ligne", "moveToUp": "vers le Haut", "moveToDown": "vers le bas", "moveToLeft": "vers la Gauche", diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.json index 1dca2d611..cd8d44e8d 100644 --- a/app/appearance/langs/he_IL.json +++ b/app/appearance/langs/he_IL.json @@ -831,7 +831,7 @@ "turnInto": "הפוך ל", "split": "חלק", "underline": "קו תחתון", - "inline-math": "מתמטיקה פנימית", + "inline-math": "נוסחה מקוונת", "moveToUp": "העבר למעלה", "moveToDown": "העבר למטה", "moveToLeft": "העבר שמאלה", diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.json index 6a296e224..dce65c41a 100644 --- a/app/appearance/langs/it_IT.json +++ b/app/appearance/langs/it_IT.json @@ -831,7 +831,7 @@ "turnInto": "Trasforma in", "split": "Dividi", "underline": "Sottolinea", - "inline-math": "Matematica in linea", + "inline-math": "Formula in linea", "moveToUp": "Sposta Su", "moveToDown": "Sposta Giù", "moveToLeft": "Sposta a Sinistra", diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.json index 97e4efb46..7f484694b 100644 --- a/app/appearance/langs/pl_PL.json +++ b/app/appearance/langs/pl_PL.json @@ -831,7 +831,7 @@ "turnInto": "Zmień w", "split": "Podziel", "underline": "Podkreślenie", - "inline-math": "Matematyka w linii", + "inline-math": "Formuła w linii", "moveToUp": "Przenieś w górę", "moveToDown": "Przenieś w dół", "moveToLeft": "Przenieś w lewo", diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.json index 21b8b771e..18007c6f4 100644 --- a/app/appearance/langs/ru_RU.json +++ b/app/appearance/langs/ru_RU.json @@ -831,7 +831,7 @@ "turnInto": "Преобразовать в", "split": "Разделить", "underline": "Подчеркнуть", - "inline-math": "Встроенная математика", + "inline-math": "Встроенная формула", "moveToUp": "Переместить вверх", "moveToDown": "Переместить вниз", "moveToLeft": "Переместить налево", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 66187f439..4605bc7af 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -831,7 +831,7 @@ "turnInto": "轉換為", "split": "並排顯示", "underline": "底線", - "inline-math": "行內數學公式", + "inline-math": "行內公式", "moveToUp": "向上移", "moveToDown": "向下移", "moveToLeft": "向左移", diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index fba0aeae1..f8deb295e 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -31,47 +31,47 @@ const getHotkeyOrMarker = (hotkey: string, marker: string) => { export const hintSlash = (key: string, protyle: IProtyle) => { const allList: IHintData[] = [{ - filter: [window.siyuan.languages.template, "moban", "muban", "mb", "template", "模板"], + filter: [window.siyuan.languages.template, "template", "模板", "moban", "muban", "mb"], id: "template", value: Constants.ZWSP, html: `
${window.siyuan.languages.template}
`, }, { - filter: [window.siyuan.languages.widget, "gj", "guajian", "widget", "挂件"], + filter: [window.siyuan.languages.widget, "widget", "挂件", "guajian", "gj"], id: "widget", value: Constants.ZWSP + 1, html: `
${window.siyuan.languages.widget}
`, }, { - filter: [window.siyuan.languages.assets, "zy", "ziyuan", "assets", "资源"], + filter: [window.siyuan.languages.assets, "assets", "资源", "ziyuan", "zy"], id: "assets", value: Constants.ZWSP + 2, html: `
${window.siyuan.languages.assets}
`, }, { - filter: [window.siyuan.languages.ref, "yinyong", "kyy", "kuaiyinyong", "block reference", "块引用"], + filter: [window.siyuan.languages.ref, "block reference", "块引用", "kuaiyinyong", "kyy"], id: "ref", value: "((", html: `
${window.siyuan.languages.ref}((
`, }, { - filter: [window.siyuan.languages.blockEmbed, "qianrukuai", "qrk", "embed block", "嵌入块"], + filter: [window.siyuan.languages.blockEmbed, "embed block", "嵌入块", "qianrukuai", "qrk"], id: "blockEmbed", value: "{{", html: `
${window.siyuan.languages.blockEmbed}{{
`, }, { - filter: [window.siyuan.languages.aiWriting, "aibianxie", "aibx", "rgzn", "人工智能"], + filter: [window.siyuan.languages.aiWriting, "ai writing", "ai编写", "aibianxie", "aibx", "人工智能", "rengongzhineng", "rgzn"], id: "aiWriting", value: Constants.ZWSP + 5, html: `
${window.siyuan.languages.aiWriting}
`, }, { - filter: [window.siyuan.languages.database, "shujuku", "sjk", "database", "view", "db", "数据库", "视图"], + filter: [window.siyuan.languages.database, "database", "db", "数据库", "shujuku", "sjk", "视图", "view"], id: "database", value: '
', html: `
${window.siyuan.languages.database}
`, }, { - filter: [window.siyuan.languages.newFileRef, "xinjianwendangbingyinyong", "xjwdbyy", "new doc", "新建文档并引用"], + filter: [window.siyuan.languages.newFileRef,"create new doc with reference", "新建文档并引用", "xinjianwendangbingyinyong", "xjwdbyy"], id: "newFileRef", value: Constants.ZWSP + 4, html: `
${window.siyuan.languages.newFileRef}
`, }, { - filter: [window.siyuan.languages.newSubDocRef, "xinjianziwendangbingyinyong", "xjzwdbyy", "sub doc", "新建子文档并引用"], + filter: [window.siyuan.languages.newSubDocRef, "create sub doc with reference", "新建子文档并引用", "xinjianziwendangbingyinyong", "xjzwdbyy"], id: "newSubDocRef", value: Constants.ZWSP + 6, html: `
${window.siyuan.languages.newSubDocRef}
`, @@ -80,72 +80,72 @@ export const hintSlash = (key: string, protyle: IProtyle) => { id: "separator_1", html: "separator", }, { - filter: [window.siyuan.languages.heading1, "yijibiaoti", "yjbt", "h1", "heading1", "一级标题"], + filter: [window.siyuan.languages.heading1, "heading1", "h1", "一级标题", "yijibiaoti", "yjbt"], id: "heading1", value: "# " + Lute.Caret, html: `
${window.siyuan.languages.heading1}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading1.custom, "# ")}
`, }, { - filter: [window.siyuan.languages.heading2, "erjibiaoti", "ejbt", "h2", "heading2", "二级标题"], + filter: [window.siyuan.languages.heading2, "heading2", "h2", "二级标题", "erjibiaoti", "ejbt"], id: "heading2", value: "## " + Lute.Caret, html: `
${window.siyuan.languages.heading2}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading2.custom, "## ")}
`, }, { - filter: [window.siyuan.languages.heading3, "sanjibiaoti", "sjbt", "h3", "heading3", "三级标题"], + filter: [window.siyuan.languages.heading3, "heading3", "h3", "三级标题", "sanjibiaoti", "sjbt"], id: "heading3", value: "### " + Lute.Caret, html: `
${window.siyuan.languages.heading3}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading3.custom, "### ")}
`, }, { - filter: [window.siyuan.languages.heading4, "sijibiaoti", "sjbt", "h4", "heading4", "四级标题"], + filter: [window.siyuan.languages.heading4, "heading4", "h4", "四级标题", "sijibiaoti", "sjbt"], id: "heading4", value: "#### " + Lute.Caret, html: `
${window.siyuan.languages.heading4}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading4.custom, "#### ")}
`, }, { - filter: [window.siyuan.languages.heading5, "wujibiaoti", "wjbt", "h5", "heading5", "五级标题"], + filter: [window.siyuan.languages.heading5, "heading5", "h5", "五级标题", "wujibiaoti", "wjbt"], id: "heading5", value: "##### " + Lute.Caret, html: `
${window.siyuan.languages.heading5}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading5.custom, "##### ")}
`, }, { - filter: [window.siyuan.languages.heading6, "liujibiaoti", "ljbt", "h6", "heading6", "六级标题"], + filter: [window.siyuan.languages.heading6, "heading6", "h6", "六级标题", "liujibiaoti", "ljbt"], id: "heading6", value: "###### " + Lute.Caret, html: `
${window.siyuan.languages.heading6}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading6.custom, "###### ")}
`, }, { - filter: [window.siyuan.languages.list, "wuxuliebiao", "wxlb", "unordered list", "无序列表"], + filter: [window.siyuan.languages.list, "unordered list", "无序列表", "wuxvliebiao", "wuxuliebiao", "wxlb"], id: "list", value: "* " + Lute.Caret, html: `
${window.siyuan.languages.list}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.list.custom, "* ")}
`, }, { - filter: [window.siyuan.languages["ordered-list"], "youxuliebiao", "yxlb", "ordered list", "有序列表"], + filter: [window.siyuan.languages["ordered-list"], "order list", "ordered list", "有序列表", "youxvliebiao", "youxuliebiao", "yxlb"], id: "orderedList", value: "1. " + Lute.Caret, html: `
${window.siyuan.languages["ordered-list"]}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert["ordered-list"].custom, "1. ")}
`, }, { - filter: [window.siyuan.languages.check, "renwuliebiao", "rwlb", "todo", "task list", "任务列表"], + filter: [window.siyuan.languages.check, "task list", "todo list", "任务列表", "renwuliebiao", "rwlb"], id: "check", value: "* [ ] " + Lute.Caret, html: `
${window.siyuan.languages.check}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.check.custom, "[]")}
`, }, { - filter: [window.siyuan.languages.quote, "yinshu", "ys", "bq", "blockquote", "引述"], + filter: [window.siyuan.languages.quote, "blockquote", "bq", "引述", "yinshu", "ys"], id: "quote", value: "> " + Lute.Caret, html: `
${window.siyuan.languages.quote}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.quote.custom, ">")}
`, }, { - filter: [window.siyuan.languages.code, "daimakuai", "dmk", "code block", "代码块"], + filter: [window.siyuan.languages.code, "code block", "代码块", "daimakuai", "dmk"], id: "code", value: "```", html: `
${window.siyuan.languages.code}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.code.custom, "```" + window.siyuan.languages.enterKey)}
`, }, { - filter: [window.siyuan.languages.table, "biaoge", "bg", "table", "表格"], + filter: [window.siyuan.languages.table, "table", "表格", "biaoge", "bg"], id: "table", value: `| ${Lute.Caret} | | |\n| --- | --- | --- |\n| | | |\n| | | |`, html: `
${window.siyuan.languages.table}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.table.custom))}
`, }, { - filter: [window.siyuan.languages.line, "fengexian", "fgx", "divider", "thematic", "break", "分隔线", "分割线"], + filter: [window.siyuan.languages.line, "thematic break", "divider", "分隔线", "分割线", "fengexian", "fgx"], id: "line", value: "---", html: `
${window.siyuan.languages.line}---
`, }, { - filter: [window.siyuan.languages.math, "shuxuegongshikuai", "sxgsk", "math block", "数学公式块"], + filter: [window.siyuan.languages.math, "formulas block", "math block", "数学公式块", "shuxuegongshikuai", "sxgsk"], id: "math", value: "$$", html: `
${window.siyuan.languages.math}$$
`, @@ -159,62 +159,62 @@ export const hintSlash = (key: string, protyle: IProtyle) => { id: "separator_2", html: "separator", }, { - filter: [window.siyuan.languages.emoji, "biaoqing", "bq", "emoji", "表情"], + filter: [window.siyuan.languages.emoji, "emoji", "表情", "biaoqing", "bq"], id: "emoji", value: "emoji", html: `
${window.siyuan.languages.emoji}:
`, }, { - filter: [window.siyuan.languages.link, "lianjie", "lj", "link", "a", "链接"], + filter: [window.siyuan.languages.link, "link", "a", "链接", "lianjie", "lj"], id: "link", value: "a", html: `
${window.siyuan.languages.link}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.link.custom))}
`, }, { - filter: [window.siyuan.languages.bold, "cuti", "ct", "bold", "strong", "粗体"], + filter: [window.siyuan.languages.bold, "bold", "strong", "粗体", "cuti", "ct", "加粗", "jiacu", "jc"], id: "bold", value: "strong", html: `
${window.siyuan.languages.bold}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.bold.custom))}
`, }, { - filter: [window.siyuan.languages.italic, "xieti", "xt", "italic", "em", "斜体"], + filter: [window.siyuan.languages.italic, "italic", "em", "斜体", "xieti", "xt"], id: "italic", value: "em", html: `
${window.siyuan.languages.italic}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.italic.custom))}
`, }, { - filter: [window.siyuan.languages.underline, "xiahuaxian", "xhx", "underline", "下划线"], + filter: [window.siyuan.languages.underline, "underline", "下划线", "xiahuaxian", "xhx"], id: "underline", value: "u", html: `
${window.siyuan.languages.underline}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.underline.custom))}
`, }, { - filter: [window.siyuan.languages.strike, "shanchuxian", "scx", "strike", "del", "删除线"], + filter: [window.siyuan.languages.strike, "strike", "delete", "删除线", "shanchuxian", "scx"], id: "strike", value: "s", html: `
${window.siyuan.languages.strike}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.strike.custom))}
`, }, { - filter: [window.siyuan.languages.mark, "biaoji", "bj", "mark", "标记"], + filter: [window.siyuan.languages.mark, "mark", "标记", "biaoji", "bj", "高亮", "gaoliang", "gl"], id: "mark", value: "mark", html: `
${window.siyuan.languages.mark}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.mark.custom))}
`, }, { - filter: [window.siyuan.languages.sup, "shangbiao", "sb", "superscript", "上标"], + filter: [window.siyuan.languages.sup, "superscript", "上标", "shangbiao", "sb"], id: "sup", value: "sup", html: `
${window.siyuan.languages.sup}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.sup.custom))}
`, }, { - filter: [window.siyuan.languages.sub, "xiaobiao", "xb", "subscript", "下标"], + filter: [window.siyuan.languages.sub, "subscript", "下标", "xiaobiao", "xb"], id: "sub", value: "sub", html: `
${window.siyuan.languages.sub}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.sub.custom))}
`, }, { - filter: [window.siyuan.languages.tag, "biaoqian", "bq", "tag", "标签"], + filter: [window.siyuan.languages.tag, "tags", "标签", "biaoqian", "bq"], id: "tag", value: "tag", html: `
${window.siyuan.languages.tag}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}
`, }, { - filter: [window.siyuan.languages["inline-code"], "hangjidaima", "hjdm", "inline code", "行级代码"], + filter: [window.siyuan.languages["inline-code"], "inline code", "行级代码", "hangjidaima", "hjdm"], id: "inlineCode", value: "code", html: `
${window.siyuan.languages["inline-code"]}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-code"].custom))}
`, }, { - filter: [window.siyuan.languages["inline-math"], "hangjigongshi", "hjgs", "hangjishuxvegongshi", "hjsxgs", "inline math", "行级公式", "行级数学公式"], + filter: [window.siyuan.languages["inline-math"], "inline formulas", "inline math", "行级公式", "hangjigongshi", "hjgs", "行级数学公式", "hangjishuxvegongshi", "hangjishuxuegongshi", "hjsxgs"], id: "inlineMath", value: "inline-math", html: `
${window.siyuan.languages["inline-math"]}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-math"].custom))}
`, @@ -223,28 +223,28 @@ export const hintSlash = (key: string, protyle: IProtyle) => { id: "separator_3", html: "separator", }, { - filter: [window.siyuan.languages.insertAsset, "charutupianhuowenjian", "crtphwj", "upload", "sc", "上传"], + filter: [window.siyuan.languages.insertAsset, "insert image or file", "upload", "插入图片或文件", "charutupianhuowenjian", "crtphwj", "上传", "sc"], id: "insertAsset", value: Constants.ZWSP + 3, html: `
${window.siyuan.languages.insertAsset}
`, }, { - filter: [window.siyuan.languages.insertIframeURL, "charuiframelianjie", "criframelj", "iframe"], + filter: [window.siyuan.languages.insertIframeURL, "insert iframe link", "插入 iframe 链接", "charuiframelianjie", "criframelj"], id: "insertIframeURL", value: '', html: `
${window.siyuan.languages.insertIframeURL}
`, }, { - filter: [window.siyuan.languages.insertImgURL, "charutupianlianjie", "crtptp", "img", "image", "图片"], + filter: [window.siyuan.languages.insertImgURL, "insert image link", "image", "img", "插入图片链接", "charutupianlianjie", "crtplj"], id: "insertImgURL", value: "![]()", html: `
${window.siyuan.languages.insertImgURL}
`, }, { - filter: [window.siyuan.languages.insertVideoURL, "charushipinlianjie", "crsplj", "video", "视频"], + filter: [window.siyuan.languages.insertVideoURL, "insert video link", "插入视频链接", "charushipinlianjie", "crsplj"], id: "insertVideoURL", value: '', html: `
${window.siyuan.languages.insertVideoURL}
`, }, { - filter: [window.siyuan.languages.insertAudioURL, "charuyinpinlianjie", "cryplj", "audio", "音频"], + filter: [window.siyuan.languages.insertAudioURL, "insert audio link", "插入音频链接", "charuyinpinlianjie", "cryplj"], id: "insertAudioURL", value: '', html: `
${window.siyuan.languages.insertAudioURL}
`, @@ -253,37 +253,37 @@ export const hintSlash = (key: string, protyle: IProtyle) => { id: "separator_4", html: "separator", }, { - filter: [window.siyuan.languages.staff, "wuxianpu", "wxp", "staff", "五线谱"], + filter: [window.siyuan.languages.staff, "staff", "五线谱", "wuxianpu", "wxp"], id: "staff", value: "```abc\n```", html: `
ABC${window.siyuan.languages.staff}
`, }, { - filter: [window.siyuan.languages.chart, "tubiao", "tb", "chart", "图表"], + filter: [window.siyuan.languages.chart, "chart", "图表", "tubiao", "tb"], id: "chart", value: "```echarts\n```", html: `
Chart${window.siyuan.languages.chart}
`, }, { - filter: ["流程图", "liuchengtu", "lct", "flowchart"], + filter: ["flowchart", "flow chart", "流程图", "liuchengtu", "lct"], id: "flowChart", value: "```flowchart\n```", html: '
FlowChartFlow Chart
', }, { - filter: ["状态图", "zhuangtaitu", "ztt", "graphviz"], + filter: ["graphviz", "状态图", "zhuangtaitu", "ztt"], id: "graph", value: "```graphviz\n```", html: '
GraphvizGraph
', }, { - filter: ["图表", "tubiao", "tb", "diagram", "mermaid"], + filter: ["mermaid", "diagram", "图表", "tubiao", "tb"], id: "mermaid", value: "```mermaid\n```", html: '
MermaidMermaid
', }, { - filter: [window.siyuan.languages.mindmap, "naotu", "nt"], + filter: [window.siyuan.languages.mindmap, "mindmap", "脑图", "naotu", "nt"], id: "mindmap", value: "```mindmap\n```", html: `
Mind map${window.siyuan.languages.mindmap}
`, }, { - filter: ["建模语言", "jianmoyuyan", "jmyy", "PlantUML"], + filter: ["plantuml", "建模语言", "jianmoyuyan", "jmyy"], id: "UML", value: "```plantuml\n```", html: '
PlantUMLUML
', @@ -292,27 +292,27 @@ export const hintSlash = (key: string, protyle: IProtyle) => { id: "separator_5", html: "separator", }, { - filter: [window.siyuan.languages.infoStyle, "xinxiyangshi", "xxys"], + filter: [window.siyuan.languages.infoStyle, "info style", "信息样式", "xinxiyangshi", "xxys"], id: "infoStyle", value: `style${Constants.ZWSP}color: var(--b3-card-info-color);background-color: var(--b3-card-info-background);`, html: `
A
${window.siyuan.languages.infoStyle}
`, }, { - filter: [window.siyuan.languages.successStyle, "chenggongyangshi", "cgys"], + filter: [window.siyuan.languages.successStyle, "success style", "成功样式", "chenggongyangshi", "cgys"], id: "successStyle", value: `style${Constants.ZWSP}color: var(--b3-card-success-color);background-color: var(--b3-card-success-background);`, html: `
A
${window.siyuan.languages.successStyle}
`, }, { - filter: [window.siyuan.languages.warningStyle, "jinggaoyangshi", "jgys"], + filter: [window.siyuan.languages.warningStyle, "warning style", "警告样式", "jinggaoyangshi", "jgys"], id: "warningStyle", value: `style${Constants.ZWSP}color: var(--b3-card-warning-color);background-color: var(--b3-card-warning-background);`, html: `
A
${window.siyuan.languages.warningStyle}
`, }, { - filter: [window.siyuan.languages.errorStyle, "cuowuyangshi", "cwys"], + filter: [window.siyuan.languages.errorStyle, "error style", "错误样式", "cuowuyangshi", "cwys"], id: "errorStyle", value: `style${Constants.ZWSP}color: var(--b3-card-error-color);background-color: var(--b3-card-error-background);`, html: `
A
${window.siyuan.languages.errorStyle}
`, }, { - filter: [window.siyuan.languages.clearFontStyle, "qingchuyangshi", "qcys"], + filter: [window.siyuan.languages.clearFontStyle, "clear style", "清除样式", "qingchuyangshi", "qcys"], id: "clearFontStyle", value: `style${Constants.ZWSP}`, html: `
A
${window.siyuan.languages.clearFontStyle}
`, From 632dcd08f3c8a40df40fade550c9b1ca0ac0e47b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 14 Jan 2025 17:31:26 +0800 Subject: [PATCH 3/4] :art: Improve tree block stat https://github.com/siyuan-note/siyuan/issues/13811 --- kernel/filesys/stat.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/filesys/stat.go b/kernel/filesys/stat.go index c7538eb24..baeb9cf27 100644 --- a/kernel/filesys/stat.go +++ b/kernel/filesys/stat.go @@ -93,7 +93,7 @@ func statTree(tree *parse.Tree) (ret *util.BlockStatResult) { blockCount := 0 var databaseBlockNodes []*ast.Node ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { - if !entering { + if !entering || tree.Root == n { return ast.WalkContinue } From 28df28a37e67f4b80f7aab27ed832fef09b14dc5 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 14 Jan 2025 21:02:42 +0800 Subject: [PATCH 4/4] :art: Backlink count at the doc block title including sub-blocks https://github.com/siyuan-note/siyuan/issues/13791 --- kernel/sql/block_ref_query.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sql/block_ref_query.go b/kernel/sql/block_ref_query.go index f786b8288..bef897f0a 100644 --- a/kernel/sql/block_ref_query.go +++ b/kernel/sql/block_ref_query.go @@ -362,9 +362,9 @@ func QueryRefIDsByDefID(defID string, containChildren bool) (refIDs []string) { var rows *sql.Rows var err error if containChildren { - rows, err = query("SELECT block_id FROM refs WHERE def_block_root_id = ?", defID) + rows, err = query("SELECT DISTINCT block_id FROM refs WHERE def_block_root_id = ?", defID) } else { - rows, err = query("SELECT block_id FROM refs WHERE def_block_id = ?", defID) + rows, err = query("SELECT DISTINCT block_id FROM refs WHERE def_block_id = ?", defID) } if err != nil { logging.LogErrorf("sql query failed: %s", err)