🐛 偶发编辑文档标题后引用处的动态锚文本不更新 Fix https://github.com/siyuan-note/siyuan/issues/5891

This commit is contained in:
Liang Ding
2022-09-26 20:54:22 +08:00
parent a8560b365b
commit 5861be23ee
3 changed files with 18 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ package treenode
import (
"bytes"
"strings"
"sync"
"github.com/88250/lute"
"github.com/88250/lute/ast"
@@ -358,6 +359,8 @@ func GetLegacyDynamicBlockRefDefIDs(node *ast.Node) (ret []string) {
return
}
var DynamicRefTexts = sync.Map{}
func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
if !IsBlockRef(blockRef) {
return
@@ -384,6 +387,9 @@ func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
blockRef.TextMarkBlockRefSubtype = "d"
blockRef.TextMarkTextContent = refText
// 偶发编辑文档标题后引用处的动态锚文本不更新 https://github.com/siyuan-note/siyuan/issues/5891
DynamicRefTexts.Store(blockRef.TextMarkBlockRefID, refText)
}
func GetDynamicBlockRefText(blockRef *ast.Node) string {