mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Clean code
This commit is contained in:
parent
f3fff63b7d
commit
abfddf76a5
3 changed files with 6 additions and 4 deletions
|
|
@ -654,4 +654,6 @@ var (
|
||||||
const (
|
const (
|
||||||
NodeAttrNameAvs = "custom-avs" // 用于标记块所属的属性视图,逗号分隔 av id
|
NodeAttrNameAvs = "custom-avs" // 用于标记块所属的属性视图,逗号分隔 av id
|
||||||
NodeAttrView = "custom-sy-av-view" // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
|
NodeAttrView = "custom-sy-av-view" // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
|
||||||
|
|
||||||
|
NodeAttrViewNames = "av-names" // 用于临时标记块所属的属性视图名称,空格分隔
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1720,7 +1720,7 @@ func setAttributeViewName(operation *Operation) (err error) {
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
|
avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
|
||||||
oldAttrs := parse.IAL2Map(node.KramdownIAL)
|
oldAttrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
node.SetIALAttr("av-names", avNames)
|
node.SetIALAttr(av.NodeAttrViewNames, avNames)
|
||||||
pushBroadcastAttrTransactions(oldAttrs, node)
|
pushBroadcastAttrTransactions(oldAttrs, node)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
@ -2087,7 +2087,7 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
|
||||||
|
|
||||||
avNames := getAvNames(attrs[av.NodeAttrNameAvs])
|
avNames := getAvNames(attrs[av.NodeAttrNameAvs])
|
||||||
if "" != avNames {
|
if "" != avNames {
|
||||||
attrs["av-names"] = avNames
|
attrs[av.NodeAttrViewNames] = avNames
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != tx {
|
if nil != tx {
|
||||||
|
|
@ -2207,7 +2207,7 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
|
||||||
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
||||||
node.SetIALAttr(av.NodeAttrNameAvs, strings.Join(avIDs, ","))
|
node.SetIALAttr(av.NodeAttrNameAvs, strings.Join(avIDs, ","))
|
||||||
avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
|
avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
|
||||||
attrs["av-names"] = avNames
|
attrs[av.NodeAttrViewNames] = avNames
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -736,7 +736,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
||||||
// 填充属性视图角标 Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545
|
// 填充属性视图角标 Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545
|
||||||
avNames := getAvNames(n.IALAttr(av.NodeAttrNameAvs))
|
avNames := getAvNames(n.IALAttr(av.NodeAttrNameAvs))
|
||||||
if "" != avNames {
|
if "" != avNames {
|
||||||
n.SetIALAttr("av-names", avNames)
|
n.SetIALAttr(av.NodeAttrViewNames, avNames)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue