mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-04 01:09:31 +08:00
🎨 The backlink panel no longer displays child-block references https://github.com/siyuan-note/siyuan/issues/12861
This commit is contained in:
parent
ae32c69bdd
commit
e2b2d46a47
@ -437,7 +437,7 @@ 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: true
|
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");
|
||||||
|
@ -44,7 +44,7 @@ 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: true
|
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);
|
||||||
|
@ -240,7 +240,7 @@ func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode
|
|||||||
rootID := sqlBlock.RootID
|
rootID := sqlBlock.RootID
|
||||||
boxID = sqlBlock.Box
|
boxID = sqlBlock.Box
|
||||||
|
|
||||||
refs := sql.QueryRefsByDefID(id, true)
|
refs := sql.QueryRefsByDefID(id, false)
|
||||||
refs = removeDuplicatedRefs(refs)
|
refs = removeDuplicatedRefs(refs)
|
||||||
|
|
||||||
linkRefs, linkRefsCount, excludeBacklinkIDs := buildLinkRefs(rootID, refs, keyword)
|
linkRefs, linkRefsCount, excludeBacklinkIDs := buildLinkRefs(rootID, refs, keyword)
|
||||||
@ -339,7 +339,7 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int) (boxID strin
|
|||||||
boxID = sqlBlock.Box
|
boxID = sqlBlock.Box
|
||||||
|
|
||||||
var links []*Block
|
var links []*Block
|
||||||
refs := sql.QueryRefsByDefID(id, true)
|
refs := sql.QueryRefsByDefID(id, false)
|
||||||
refs = removeDuplicatedRefs(refs)
|
refs = removeDuplicatedRefs(refs)
|
||||||
|
|
||||||
// 为了减少查询,组装好 IDs 后一次查出
|
// 为了减少查询,组装好 IDs 后一次查出
|
||||||
|
@ -389,16 +389,8 @@ func QueryRefsRecent(onlyDoc bool, typeFilter string, ignoreLines []string) (ret
|
|||||||
}
|
}
|
||||||
|
|
||||||
func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {
|
func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {
|
||||||
sqlBlock := GetBlock(defBlockID)
|
|
||||||
if nil == sqlBlock {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var rows *sql.Rows
|
var rows *sql.Rows
|
||||||
var err error
|
var err error
|
||||||
if "d" == sqlBlock.Type {
|
|
||||||
rows, err = query("SELECT * FROM refs WHERE def_block_root_id = ?", defBlockID)
|
|
||||||
} else {
|
|
||||||
if containChildren {
|
if containChildren {
|
||||||
blockIDs := queryBlockChildrenIDs(defBlockID)
|
blockIDs := queryBlockChildrenIDs(defBlockID)
|
||||||
var params []string
|
var params []string
|
||||||
@ -409,7 +401,6 @@ func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {
|
|||||||
} else {
|
} else {
|
||||||
rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)
|
rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logging.LogErrorf("sql query failed: %s", err)
|
logging.LogErrorf("sql query failed: %s", err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user