Kaynağa Gözat

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 8 ay önce
ebeveyn
işleme
fd743f15ac

+ 2 - 0
app/appearance/langs/de_DE.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "Enthalten Rückverweise untergeordnete Blöcke",
+  "backlinkContainChildrenTip": "Wenn aktiviert, werden untergeordnete Blöcke in die Berechnung der Rückverweise einbezogen",
   "entryNum": "Anzahl der Einträge",
   "workspaceData": "Arbeitsbereichsdaten",
   "confirmRemoveRelationField": "Sind Sie sicher, dass Sie das Feld, das mit <b>${x}</b> verknüpft ist, löschen möchten?",

+ 2 - 0
app/appearance/langs/en_US.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "Do backlinks contain child blocks",
+  "backlinkContainChildrenTip": "When enabled, child blocks will be included in the backlink calculation",
   "entryNum": "Number of entries",
   "workspaceData": "Workspace data",
   "confirmRemoveRelationField": "Are you sure you want to delete the field associated with <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/es_ES.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "¿Los enlaces inversos contienen bloques secundarios?",
+  "backlinkContainChildrenTip": "Una vez habilitado, los bloques secundarios se incluirán en el cálculo de los enlaces inversos",
   "entryNum": "Número de entradas",
   "workspaceData": "Datos del espacio de trabajo",
   "confirmRemoveRelationField": "¿Está seguro de que desea eliminar el campo asociado a <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/fr_FR.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "Les liens retour contiennent-ils des sous-blocs",
+  "backlinkContainChildrenTip": "Une fois activé, les sous-blocs seront inclus dans le calcul des liens retour",
   "entryNum": "Nombre d'entrées",
   "workspaceData": "Données de l'espace de travail",
   "confirmRemoveRelationField": "Êtes-vous sûr de vouloir supprimer le champ associé à <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/he_IL.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "האם קישורים חוזרים כוללים בלוקים משניים",
+  "backlinkContainChildrenTip": "לאחר ההפעלה, בלוקים משניים ייכללו בחישוב הקישורים החוזרים",
   "entryNum": "מספר ערכים",
   "workspaceData": "נתוני סביבת עבודה",
   "confirmRemoveRelationField": "האם אתה בטוח שברצונך למחוק את השדה המשויך ל-<b>${x}</b>?",

+ 2 - 0
app/appearance/langs/it_IT.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "I backlink contengono blocchi figli",
+  "backlinkContainChildrenTip": "Dopo l'attivazione, i blocchi figli saranno inclusi nel calcolo dei backlink",
   "entryNum": "Numero di voci",
   "workspaceData": "Dati dello spazio di lavoro",
   "confirmRemoveRelationField": "Sei sicuro di voler eliminare il campo associato a <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/ja_JP.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "バックリンクに子ブロックを含めるかどうか",
+  "backlinkContainChildrenTip": "有効にすると、子ブロックがバックリンク計算に含まれます",
   "entryNum": "エントリ数",
   "workspaceData": "ワークスペースデータ",
   "confirmRemoveRelationField": "<b>${x}</b> に関連するフィールドを同時に削除してもよろしいですか?",

+ 2 - 0
app/appearance/langs/pl_PL.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "Czy linki zwrotne zawierają bloki podrzędne",
+  "backlinkContainChildrenTip": "Po włączeniu bloki podrzędne zostaną uwzględnione w obliczeniach linków zwrotnych",
   "entryNum": "Количество записей",
   "workspaceData": "Dane przestrzeni roboczej",
   "confirmRemoveRelationField": "Czy na pewno chcesz usunąć pole powiązane z <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/ru_RU.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "Включать ли дочерние блоки в обратные ссылки",
+  "backlinkContainChildrenTip": "После включения дочерние блоки будут включены в расчет обратных ссылок",
   "entryNum": "Количество записей",
   "workspaceData": "Данные рабочей области",
   "confirmRemoveRelationField": "Вы уверены, что хотите удалить поле, связанное с <b>${x}</b>?",

+ 2 - 0
app/appearance/langs/zh_CHT.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "反向鏈接包含子塊",
+  "backlinkContainChildrenTip": "啟用後子塊將被納入到反向鏈接計算中",
   "entryNum": "條目數",
   "workspaceData": "工作空間數據",
   "confirmRemoveRelationField": "確定同時刪除關聯至 <b>${x}</b> 中的字段嗎?",

+ 2 - 0
app/appearance/langs/zh_CN.json

@@ -1,4 +1,6 @@
 {
+  "backlinkContainChildren": "反向链接包含子块",
+  "backlinkContainChildrenTip": "启用后子块将被纳入到反向链接计算中",
   "entryNum": "条目数",
   "workspaceData": "工作空间数据",
   "confirmRemoveRelationField": "确定同时删除关联至 <b>${x}</b> 中的字段吗?",

+ 4 - 2
app/changelogs/v3.1.10/v3.1.10.md

@@ -2,7 +2,7 @@
 
 This version improves database performance and user interface details.
 
-In addition, we have also improved the backlink panel logic and no longer include sub-blocks in the calculation, which helps to display backlinks more accurately.
+In addition, we have also improved the backlink panel details to support excluding child-blocks from backlink calculations, which helps to display backlinks more accurately.
 
 ## Changelogs
 
@@ -13,6 +13,7 @@ Below are the detailed changes in this version.
 * [Improve interaction when deleting two-way relation field in a database](https://github.com/siyuan-note/siyuan/issues/11252)
 * [Improve plugin dock position persistence](https://github.com/siyuan-note/siyuan/issues/11931)
 * [Supports disabling Markdown `~~` syntax input](https://github.com/siyuan-note/siyuan/issues/12641)
+* [Improve database paging loading](https://github.com/siyuan-note/siyuan/issues/12780)
 * [WebDAV/S3 data sync and backup support configurable concurrent requests](https://github.com/siyuan-note/siyuan/issues/12798)
 * [Improve the logic of multiple selected blocks forming a super block](https://github.com/siyuan-note/siyuan/issues/12809)
 * [Browser clipping extension sends no more scrolling pages](https://github.com/siyuan-note/siyuan/issues/12817)
@@ -22,8 +23,9 @@ Below are the detailed changes in this version.
 * [Improve database relation & rollup field loading performance](https://github.com/siyuan-note/siyuan/issues/12835)
 * [Improve user interface](https://github.com/siyuan-note/siyuan/issues/12848)
 * [Refresh doc tree after data sync](https://github.com/siyuan-note/siyuan/issues/12860)
-* [The backlink panel no longer displays child-block references](https://github.com/siyuan-note/siyuan/issues/12861)
+* [Support child-blocks not being included in the backlink calculation](https://github.com/siyuan-note/siyuan/issues/12861)
 * [The backlink panel no longer displays breadcrumbs of the first-level blocks](https://github.com/siyuan-note/siyuan/issues/12862)
+* [Improve custom emojis at the beginning of the block](https://github.com/siyuan-note/siyuan/issues/12868)
 
 ### Bugfix
 

+ 5 - 3
app/changelogs/v3.1.10/v3.1.10_zh_CHT.md

@@ -2,7 +2,7 @@
 
 此版本改進了資料庫效能和使用者介面細節。
 
-另外,我們也改進了反鏈面板邏輯,不再將子塊納入計算,這有助於更精確地顯示反鏈。
+另外,我們也改進了反鏈面板細節,支援子區塊不納入反鏈計算,這有助於更精確地顯示反鏈。
 
 ## 變更記錄
 
@@ -13,6 +13,7 @@
 * [改進刪除資料庫中雙向關聯欄位時的互動](https://github.com/siyuan-note/siyuan/issues/11252)
 * [改進插件停靠列位置的持久化](https://github.com/siyuan-note/siyuan/issues/11931)
 * [支援禁用 Markdown `~~` 語法輸入](https://github.com/siyuan-note/siyuan/issues/12641)
+* [改進資料庫分頁載入](https://github.com/siyuan-note/siyuan/issues/12780)
 * [WebDAV/S3 資料同步與備份支援設定並發請求數](https://github.com/siyuan-note/siyuan/issues/12798)
 * [改進多選塊形成超級塊的邏輯](https://github.com/siyuan-note/siyuan/issues/12809)
 * [瀏覽器剪藏擴充功能不再需要捲動頁面](https://github.com/siyuan-note/siyuan/issues/12817)
@@ -22,8 +23,9 @@
 * [改進資料庫關聯和匯總欄位載入效能](https://github.com/siyuan-note/siyuan/issues/12835)
 * [改進使用者介面](https://github.com/siyuan-note/siyuan/issues/12848)
 * [資料同步後刷新文件樹](https://github.com/siyuan-note/siyuan/issues/12860)
-* [反向連結面板不再顯示子塊引用](https://github.com/siyuan-note/siyuan/issues/12861)
+* [支援子區塊不納入反鏈計算](https://github.com/siyuan-note/siyuan/issues/12861)
 * [反向連結面板不再顯示一一級塊的麵包屑](https://github.com/siyuan-note/siyuan/issues/12862)
+* [改進區塊開始處的自訂表情](https://github.com/siyuan-note/siyuan/issues/12868)
 
 ### 修復缺陷
 
@@ -36,4 +38,4 @@
 ## 下載
 
 * [B3log](https://b3log.org/siyuan/download.html)
-* [GitHub](https://github.com/siyuan-note/siyuan/releases)
+* [GitHub](https://github.com/siyuan-note/siyuan/releases)

+ 4 - 2
app/changelogs/v3.1.10/v3.1.10_zh_CN.md

@@ -2,7 +2,7 @@
 
 该版本改进了数据库性能和用户界面细节。
 
-另外,我们也改进了反链面板逻辑,不再将子块纳入计算,这有助于更加精确地显示反链。
+另外,我们也改进了反链面板细节,支持子块不纳入反链计算,这有助于更加精确地显示反链。
 
 ## 变更记录
 
@@ -13,6 +13,7 @@
 * [改进删除数据库中双向关联字段时的交互](https://github.com/siyuan-note/siyuan/issues/11252)
 * [改进插件停靠栏位置的持久化](https://github.com/siyuan-note/siyuan/issues/11931)
 * [支持禁用 Markdown `~~` 语法输入](https://github.com/siyuan-note/siyuan/issues/12641)
+* [改进数据库分页加载](https://github.com/siyuan-note/siyuan/issues/12780)
 * [WebDAV/S3 数据同步和备份支持配置并发请求数](https://github.com/siyuan-note/siyuan/issues/12798)
 * [改进多选块形成超级块的逻辑](https://github.com/siyuan-note/siyuan/issues/12809)
 * [浏览器剪藏扩展不再需要滚动页面](https://github.com/siyuan-note/siyuan/issues/12817)
@@ -22,8 +23,9 @@
 * [改进数据库关联和汇总字段加载性能](https://github.com/siyuan-note/siyuan/issues/12835)
 * [改进用户界面](https://github.com/siyuan-note/siyuan/issues/12848)
 * [数据同步后刷新文档树](https://github.com/siyuan-note/siyuan/issues/12860)
-* [反向链接面板不再显示子块引用](https://github.com/siyuan-note/siyuan/issues/12861)
+* [支持子块不纳入反链计算](https://github.com/siyuan-note/siyuan/issues/12861)
 * [反向链接面板不再显示一级块的面包屑](https://github.com/siyuan-note/siyuan/issues/12862)
+* [改进块开始处的自定义表情](https://github.com/siyuan-note/siyuan/issues/12868)
 
 ### 修复缺陷
 

+ 9 - 0
app/src/config/editor.ts

@@ -191,6 +191,14 @@ export const editor = {
     <span class="fn__space"></span>
     <input class="b3-text-field fn__flex-center fn__size200" id="backmentionExpandCount" type="number" min="-1" max="512" value="${window.siyuan.config.editor.backmentionExpandCount}"/>
 </div>
+<label class="fn__flex b3-label">
+    <div class="fn__flex-1">
+        ${window.siyuan.languages.backlinkContainChildren}
+        <div class="b3-label__text">${window.siyuan.languages.backlinkContainChildrenTip}</div>
+    </div>
+    <span class="fn__space"></span>
+    <input class="b3-switch fn__flex-center" id="backlinkContainChildren" type="checkbox"${window.siyuan.config.editor.backlinkContainChildren ? " checked" : ""}/>
+</label>
 <div class="fn__flex b3-label config__item">
     <div class="fn__flex-1">
         ${window.siyuan.languages.generateHistory}
@@ -386,6 +394,7 @@ export const editor = {
                 blockRefDynamicAnchorTextMaxLen: parseInt((editor.element.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value),
                 backlinkExpandCount: parseInt((editor.element.querySelector("#backlinkExpandCount") as HTMLInputElement).value),
                 backmentionExpandCount: parseInt((editor.element.querySelector("#backmentionExpandCount") as HTMLInputElement).value),
+                backlinkContainChildren: (editor.element.querySelector("#backlinkContainChildren") as HTMLInputElement).checked,
                 dynamicLoadBlocks: dynamicLoadBlocks,
                 codeLigatures: (editor.element.querySelector("#codeLigatures") as HTMLInputElement).checked,
                 codeTabSpaces: parseInt((editor.element.querySelector("#codeTabSpaces") as HTMLInputElement).value),

+ 3 - 2
app/src/config/search.ts

@@ -24,8 +24,9 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
             "onlySearchForDoc", "onlySearchForDocTip", "dynamicLoadBlocks", "dynamicLoadBlocksTip", "fontSizeScrollZoom", "fontSizeScrollZoomTip",
             "listItemDotNumberClickFocus", "listItemDotNumberClickFocusTip", "editorMarkdownInlineAsterisk", "editorMarkdownInlineUnderscore",
             "editorMarkdownInlineSup", "editorMarkdownInlineSupTip", "editorMarkdownInlineSub", "editorMarkdownInlineSubTip",
-            "editorMarkdownInlineTag", "editorMarkdownInlineTagTip", "editorMarkdownInlineMath", "editorMarkdownInlineMathTip",
-            "allowHTMLBLockScript", "allowHTMLBLockScriptTip",
+            "editorMarkdownInlineTag", "editorMarkdownInlineTagTip", "editorMarkdownInlineMath", "editorMarkdownInlineMathTip", "editorMarkdownInlineStrikethrough", "editorMarkdownInlineStrikethroughTip",
+            "allowHTMLBLockScript", "allowHTMLBLockScriptTip", "backlinkExpandCount", "backlinkExpandTip", "backmentionExpandCount", "backmentionExpandTip",
+            "backlinkContainChildren", "backlinkContainChildrenTip"
         ]),
 
         // 文档树

+ 0 - 1
app/src/layout/dock/Backlink.ts

@@ -437,7 +437,6 @@ export class Backlink extends Model {
                 defID: this.blockId,
                 refTreeID: docId,
                 keyword: isMention ? this.inputsElement[1].value : this.inputsElement[0].value,
-                containChildren: false
             }, (response) => {
                 svgElement.removeAttribute("disabled");
                 svgElement.classList.add("b3-list-item__arrow--open");

+ 9 - 0
app/src/mobile/settings/editor.ts

@@ -45,6 +45,7 @@ const setEditor = (modelMainElement: Element) => {
     window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen = parseInt((modelMainElement.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value);
     window.siyuan.config.editor.backlinkExpandCount = parseInt((modelMainElement.querySelector("#backlinkExpandCount") as HTMLInputElement).value);
     window.siyuan.config.editor.backmentionExpandCount = parseInt((modelMainElement.querySelector("#backmentionExpandCount") as HTMLInputElement).value);
+    window.siyuan.config.editor.backlinkContainChildren = (modelMainElement.querySelector("#backlinkContainChildren") as HTMLInputElement).checked;
     window.siyuan.config.editor.codeLigatures = (modelMainElement.querySelector("#codeLigatures") as HTMLInputElement).checked;
     window.siyuan.config.editor.codeTabSpaces = parseInt((modelMainElement.querySelector("#codeTabSpaces") as HTMLInputElement).value);
     window.siyuan.config.editor.fontSize = parseInt((modelMainElement.querySelector("#fontSize") as HTMLInputElement).value);
@@ -220,6 +221,14 @@ export const initEditor = () => {
     <input class="b3-text-field fn__block" id="backmentionExpandCount" type="number" min="-1" max="512" value="${window.siyuan.config.editor.backmentionExpandCount}"/>
     <div class="b3-label__text">${window.siyuan.languages.backmentionExpandTip}</div>
 </div>
+<label class="fn__flex b3-label">
+    <div class="fn__flex-1">
+        ${window.siyuan.languages.backlinkContainChildren}
+        <div class="b3-label__text">${window.siyuan.languages.backlinkContainChildrenTip}</div>
+    </div>
+    <span class="fn__space"></span>
+    <input class="b3-switch fn__flex-center" id="backlinkContainChildren" type="checkbox"${window.siyuan.config.editor.backlinkContainChildren ? " checked" : ""}/>
+</label>
 <div class="b3-label">
     ${window.siyuan.languages.generateHistory}
     <span class="fn__hr"></span>

+ 0 - 1
app/src/protyle/util/reload.ts

@@ -44,7 +44,6 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?
                 defID: protyle.element.getAttribute("data-defid"),
                 refTreeID: protyle.block.rootID,
                 keyword: isMention ? inputsElement[1].value : inputsElement[0].value,
-                containChildren: false
             }, response => {
                 protyle.options.backlinkData = isMention ? response.data.backmentions : response.data.backlinks;
                 renderBacklink(protyle, protyle.options.backlinkData);

+ 4 - 0
app/src/types/config.d.ts

@@ -341,6 +341,10 @@ declare namespace Config {
          * The default number of backlinks to mention
          */
         backmentionExpandCount: number;
+        /**
+         * Whether the backlink contains children
+         */
+        backlinkContainChildren: boolean;
         /**
          * The maximum length of the dynamic anchor text for block references
          */

+ 4 - 4
kernel/api/ref.go

@@ -51,7 +51,7 @@ func getBackmentionDoc(c *gin.Context) {
 	defID := arg["defID"].(string)
 	refTreeID := arg["refTreeID"].(string)
 	keyword := arg["keyword"].(string)
-	containChildren := false
+	containChildren := model.Conf.Editor.BacklinkContainChildren
 	if val, ok := arg["containChildren"]; ok {
 		containChildren = val.(bool)
 	}
@@ -73,7 +73,7 @@ func getBacklinkDoc(c *gin.Context) {
 	defID := arg["defID"].(string)
 	refTreeID := arg["refTreeID"].(string)
 	keyword := arg["keyword"].(string)
-	containChildren := false
+	containChildren := model.Conf.Editor.BacklinkContainChildren
 	if val, ok := arg["containChildren"]; ok {
 		containChildren = val.(bool)
 	}
@@ -109,7 +109,7 @@ func getBacklink2(c *gin.Context) {
 	if nil != mentionSortArg {
 		mentionSort, _ = strconv.Atoi(mentionSortArg.(string))
 	}
-	containChildren := false
+	containChildren := model.Conf.Editor.BacklinkContainChildren
 	if val, ok := arg["containChildren"]; ok {
 		containChildren = val.(bool)
 	}
@@ -145,7 +145,7 @@ func getBacklink(c *gin.Context) {
 	if nil != arg["beforeLen"] {
 		beforeLen = int(arg["beforeLen"].(float64))
 	}
-	containChildren := false
+	containChildren := model.Conf.Editor.BacklinkContainChildren
 	if val, ok := arg["containChildren"]; ok {
 		containChildren = val.(bool)
 	}

+ 2 - 0
kernel/conf/editor.go

@@ -51,6 +51,7 @@ type Editor struct {
 	OnlySearchForDoc                bool           `json:"onlySearchForDoc"`                // 是否启用 [[ 仅搜索文档块
 	BacklinkExpandCount             int            `json:"backlinkExpandCount"`             // 反向链接默认展开数量
 	BackmentionExpandCount          int            `json:"backmentionExpandCount"`          // 反链提及默认展开数量
+	BacklinkContainChildren         bool           `json:"backlinkContainChildren"`         // 反向链接是否包含子块进行计算
 	Markdown                        *util.Markdown `json:"markdown"`                        // Markdown 配置
 }
 
@@ -86,6 +87,7 @@ func NewEditor() *Editor {
 		RTL:                             false,
 		BacklinkExpandCount:             8,
 		BackmentionExpandCount:          -1,
+		BacklinkContainChildren:         false,
 		Markdown:                        util.MarkdownSettings,
 	}
 }

+ 6 - 2
kernel/model/backlink.go

@@ -96,7 +96,9 @@ func GetBackmentionDoc(defID, refTreeID, keyword string, containChildren bool) (
 	trees := filesys.LoadTrees(mentionBlockIDs)
 	for id, tree := range trees {
 		backlink := buildBacklink(id, tree, mentionKeywords, luteEngine)
-		ret = append(ret, backlink)
+		if nil != backlink {
+			ret = append(ret, backlink)
+		}
 	}
 	return
 }
@@ -133,7 +135,9 @@ func GetBacklinkDoc(defID, refTreeID, keyword string, containChildren bool) (ret
 			keywords = append(keywords, keyword)
 		}
 		backlink := buildBacklink(linkRef.ID, refTree, keywords, luteEngine)
-		ret = append(ret, backlink)
+		if nil != backlink {
+			ret = append(ret, backlink)
+		}
 	}
 	return
 }