Skip to content

Commit 970b82a

Browse files
committed
🎨 Improve list item, super block and blockquote backlink propagation #13776
1 parent 87f3047 commit 970b82a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

kernel/api/filetree.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -1114,14 +1114,22 @@ func getDoc(c *gin.Context) {
11141114
if nil != isBacklinkArg {
11151115
isBacklink = isBacklinkArg.(bool)
11161116
}
1117+
originalRefBlockIDsArg := arg["originalRefBlockIDs"]
1118+
originalRefBlockIDs := map[string]string{}
1119+
if nil != originalRefBlockIDsArg {
1120+
m := originalRefBlockIDsArg.(map[string]interface{})
1121+
for k, v := range m {
1122+
originalRefBlockIDs[k] = v.(string)
1123+
}
1124+
}
11171125
highlightArg := arg["highlight"]
11181126
highlight := true
11191127
if nil != highlightArg {
11201128
highlight = highlightArg.(bool)
11211129
}
11221130

11231131
blockCount, content, parentID, parent2ID, rootID, typ, eof, scroll, boxID, docPath, isBacklinkExpand, keywords, err :=
1124-
model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink, highlight)
1132+
model.GetDoc(startID, endID, id, index, query, queryTypes, queryMethod, mode, size, isBacklink, originalRefBlockIDs, highlight)
11251133
if model.ErrBlockNotFound == err {
11261134
ret.Code = 3
11271135
return

kernel/model/file.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden boo
441441
return
442442
}
443443

444-
func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink, highlight bool) (
444+
func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool, originalRefBlockIDs map[string]string, highlight bool) (
445445
blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, keywords []string, err error) {
446446
//os.MkdirAll("pprof", 0755)
447447
//cpuProfile, _ := os.Create("pprof/GetDoc")
@@ -603,8 +603,6 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
603603
var nodes []*ast.Node
604604
if isBacklink {
605605
// 引用计数浮窗请求,需要按照反链逻辑组装 https://github.com/siyuan-note/siyuan/issues/6853
606-
originalRefBlockIDs := map[string]string{}
607-
// TODO 需要增加参数,使用 getRefIDs 返回的 originalRefBlockIDs 增加这个参数后才能支持计数浮窗内计算折叠状态 https://github.com/siyuan-note/siyuan/issues/13776
608606
nodes, isBacklinkExpand = getBacklinkRenderNodes(node, originalRefBlockIDs)
609607
} else {
610608
// 如果同时存在 startID 和 endID,并且是动态加载的情况,则只加载 startID 和 endID 之间的块 [startID, endID]

0 commit comments

Comments
 (0)