mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-03 03:10:16 +01:00
🎨 Improve export preview mode https://github.com/siyuan-note/siyuan/issues/16732
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
bb4d95ffa0
commit
156a28f27d
4 changed files with 49 additions and 14 deletions
|
|
@ -276,14 +276,25 @@ func refreshDynamicRefText(updatedDefNode *ast.Node, updatedTree *parse.Tree) {
|
|||
|
||||
// refreshDynamicRefTexts 用于批量刷新块引用的动态锚文本。
|
||||
// 该实现依赖了数据库缓存,导致外部调用时可能需要阻塞等待数据库写入后才能获取到 refs
|
||||
func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees map[string]*parse.Tree) {
|
||||
func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees map[string]*parse.Tree) (changedRootIDs []string) {
|
||||
for t := range updatedTrees {
|
||||
changedRootIDs = append(changedRootIDs, t)
|
||||
}
|
||||
|
||||
for i := 0; i < 7; i++ {
|
||||
updatedRefNodes, updatedRefTrees := refreshDynamicRefTexts0(updatedDefNodes, updatedTrees)
|
||||
if 1 > len(updatedRefNodes) {
|
||||
break
|
||||
}
|
||||
updatedDefNodes, updatedTrees = updatedRefNodes, updatedRefTrees
|
||||
|
||||
for t := range updatedTrees {
|
||||
changedRootIDs = append(changedRootIDs, t)
|
||||
}
|
||||
}
|
||||
|
||||
changedRootIDs = gulu.Str.RemoveDuplicatedElem(changedRootIDs)
|
||||
return
|
||||
}
|
||||
|
||||
func refreshDynamicRefTexts0(updatedDefNodes map[string]*ast.Node, updatedTrees map[string]*parse.Tree) (updatedRefNodes map[string]*ast.Node, updatedRefTrees map[string]*parse.Tree) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue