mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 23:50:13 +01:00
🎨 Clean code https://github.com/siyuan-note/siyuan/issues/13378
This commit is contained in:
parent
68748dc6cd
commit
96c59433e2
2 changed files with 13 additions and 7 deletions
|
|
@ -267,17 +267,23 @@ func getNodeRefText(node *ast.Node) string {
|
||||||
return getNodeRefText0(node, Conf.Editor.BlockRefDynamicAnchorTextMaxLen)
|
return getNodeRefText0(node, Conf.Editor.BlockRefDynamicAnchorTextMaxLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNodeAvBlockText(node *ast.Node) string {
|
func getNodeAvBlockText(node *ast.Node) (ret string) {
|
||||||
if nil == node {
|
if nil == node {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if ret := node.IALAttr("name"); "" != ret {
|
if name := node.IALAttr("name"); "" != name {
|
||||||
ret = strings.TrimSpace(ret)
|
name = strings.TrimSpace(name)
|
||||||
ret = util.EscapeHTML(ret)
|
name = util.EscapeHTML(name)
|
||||||
return ret
|
ret = name
|
||||||
|
} else {
|
||||||
|
ret = getNodeRefText0(node, 1024)
|
||||||
}
|
}
|
||||||
return getNodeRefText0(node, 1024)
|
|
||||||
|
//if icon := node.IALAttr("icon"); "" != icon {
|
||||||
|
// ret = icon + " " + ret
|
||||||
|
//}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNodeRefText0(node *ast.Node, maxLen int) string {
|
func getNodeRefText0(node *ast.Node, maxLen int) string {
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
|
||||||
|
|
||||||
for _, blockValue := range blockValues.Values {
|
for _, blockValue := range blockValues.Values {
|
||||||
if blockValue.Block.ID == updatedDefNode.ID {
|
if blockValue.Block.ID == updatedDefNode.ID {
|
||||||
newContent := getNodeRefText(updatedDefNode)
|
newContent := getNodeAvBlockText(updatedDefNode)
|
||||||
if newContent != blockValue.Block.Content {
|
if newContent != blockValue.Block.Content {
|
||||||
blockValue.Block.Content = newContent
|
blockValue.Block.Content = newContent
|
||||||
changedAv = true
|
changedAv = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue