🎨 The backlink panel no longer displays child-block references https://github.com/siyuan-note/siyuan/issues/12861

This commit is contained in:
Daniel 2024-10-21 23:40:51 +08:00
parent c9f5a2de3d
commit f708e99a74
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017
19 changed files with 53 additions and 8 deletions

View File

@ -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", "entryNum": "Anzahl der Einträge",
"workspaceData": "Arbeitsbereichsdaten", "workspaceData": "Arbeitsbereichsdaten",
"confirmRemoveRelationField": "Sind Sie sicher, dass Sie das Feld, das mit <b>${x}</b> verknüpft ist, löschen möchten?", "confirmRemoveRelationField": "Sind Sie sicher, dass Sie das Feld, das mit <b>${x}</b> verknüpft ist, löschen möchten?",

View File

@ -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", "entryNum": "Number of entries",
"workspaceData": "Workspace data", "workspaceData": "Workspace data",
"confirmRemoveRelationField": "Are you sure you want to delete the field associated with <b>${x}</b>?", "confirmRemoveRelationField": "Are you sure you want to delete the field associated with <b>${x}</b>?",

View File

@ -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", "entryNum": "Número de entradas",
"workspaceData": "Datos del espacio de trabajo", "workspaceData": "Datos del espacio de trabajo",
"confirmRemoveRelationField": "¿Está seguro de que desea eliminar el campo asociado a <b>${x}</b>?", "confirmRemoveRelationField": "¿Está seguro de que desea eliminar el campo asociado a <b>${x}</b>?",

View File

@ -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", "entryNum": "Nombre d'entrées",
"workspaceData": "Données de l'espace de travail", "workspaceData": "Données de l'espace de travail",
"confirmRemoveRelationField": "Êtes-vous sûr de vouloir supprimer le champ associé à <b>${x}</b>?", "confirmRemoveRelationField": "Êtes-vous sûr de vouloir supprimer le champ associé à <b>${x}</b>?",

View File

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

View File

@ -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", "entryNum": "Numero di voci",
"workspaceData": "Dati dello spazio di lavoro", "workspaceData": "Dati dello spazio di lavoro",
"confirmRemoveRelationField": "Sei sicuro di voler eliminare il campo associato a <b>${x}</b>?", "confirmRemoveRelationField": "Sei sicuro di voler eliminare il campo associato a <b>${x}</b>?",

View File

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

View File

@ -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": "Количество записей", "entryNum": "Количество записей",
"workspaceData": "Dane przestrzeni roboczej", "workspaceData": "Dane przestrzeni roboczej",
"confirmRemoveRelationField": "Czy na pewno chcesz usunąć pole powiązane z <b>${x}</b>?", "confirmRemoveRelationField": "Czy na pewno chcesz usunąć pole powiązane z <b>${x}</b>?",

View File

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

View File

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

View File

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

View File

@ -191,6 +191,14 @@ export const editor = {
<span class="fn__space"></span> <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}"/> <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> </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 b3-label config__item">
<div class="fn__flex-1"> <div class="fn__flex-1">
${window.siyuan.languages.generateHistory} ${window.siyuan.languages.generateHistory}
@ -386,6 +394,7 @@ export const editor = {
blockRefDynamicAnchorTextMaxLen: parseInt((editor.element.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value), blockRefDynamicAnchorTextMaxLen: parseInt((editor.element.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value),
backlinkExpandCount: parseInt((editor.element.querySelector("#backlinkExpandCount") as HTMLInputElement).value), backlinkExpandCount: parseInt((editor.element.querySelector("#backlinkExpandCount") as HTMLInputElement).value),
backmentionExpandCount: parseInt((editor.element.querySelector("#backmentionExpandCount") as HTMLInputElement).value), backmentionExpandCount: parseInt((editor.element.querySelector("#backmentionExpandCount") as HTMLInputElement).value),
backlinkContainChildren: (editor.element.querySelector("#backlinkContainChildren") as HTMLInputElement).checked,
dynamicLoadBlocks: dynamicLoadBlocks, dynamicLoadBlocks: dynamicLoadBlocks,
codeLigatures: (editor.element.querySelector("#codeLigatures") as HTMLInputElement).checked, codeLigatures: (editor.element.querySelector("#codeLigatures") as HTMLInputElement).checked,
codeTabSpaces: parseInt((editor.element.querySelector("#codeTabSpaces") as HTMLInputElement).value), codeTabSpaces: parseInt((editor.element.querySelector("#codeTabSpaces") as HTMLInputElement).value),

View File

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

View File

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

View File

@ -45,6 +45,7 @@ const setEditor = (modelMainElement: Element) => {
window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen = parseInt((modelMainElement.querySelector("#blockRefDynamicAnchorTextMaxLen") as HTMLInputElement).value); 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.backlinkExpandCount = parseInt((modelMainElement.querySelector("#backlinkExpandCount") as HTMLInputElement).value);
window.siyuan.config.editor.backmentionExpandCount = parseInt((modelMainElement.querySelector("#backmentionExpandCount") 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.codeLigatures = (modelMainElement.querySelector("#codeLigatures") as HTMLInputElement).checked;
window.siyuan.config.editor.codeTabSpaces = parseInt((modelMainElement.querySelector("#codeTabSpaces") as HTMLInputElement).value); window.siyuan.config.editor.codeTabSpaces = parseInt((modelMainElement.querySelector("#codeTabSpaces") as HTMLInputElement).value);
window.siyuan.config.editor.fontSize = parseInt((modelMainElement.querySelector("#fontSize") 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}"/> <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 class="b3-label__text">${window.siyuan.languages.backmentionExpandTip}</div>
</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"> <div class="b3-label">
${window.siyuan.languages.generateHistory} ${window.siyuan.languages.generateHistory}
<span class="fn__hr"></span> <span class="fn__hr"></span>

View File

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

View File

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

View File

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

View File

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