🐛 引用命名块时动态锚文本没有使用命名 Fix https://github.com/siyuan-note/siyuan/issues/6032

This commit is contained in:
Liang Ding 2022-09-30 22:33:41 +08:00
parent 3555df9267
commit 801e5d12e1
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -24,7 +24,6 @@ import (
"strings"
"sync"
"time"
"unicode/utf8"
"github.com/88250/gulu"
"github.com/88250/lute/ast"
@ -1131,11 +1130,9 @@ func updateRefText(refNode *ast.Node, changedDefNodes map[string]*ast.Node) (cha
if ast.NodeDocument != defNode.Type && defNode.IsContainerBlock() {
defNode = treenode.FirstLeafBlock(defNode)
}
defContent := renderBlockText(defNode)
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(defContent) {
defContent = gulu.Str.SubStr(defContent, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
}
treenode.SetDynamicBlockRefText(n, defContent)
refText := getNodeRefText(defNode)
treenode.SetDynamicBlockRefText(n, refText)
changed = true
return ast.WalkContinue
})