🎨 Improve document tag adding interaction https://github.com/siyuan-note/siyuan/issues/13311
This commit is contained in:
parent
a5363fa0b4
commit
922f9fe075
1 changed files with 16 additions and 0 deletions
|
@ -215,6 +215,22 @@ func setNodeAttrs0(node *ast.Node, nameValues map[string]string) (oldAttrs map[s
|
|||
}
|
||||
}
|
||||
|
||||
if tag, ok := nameValues["tags"]; ok {
|
||||
var tags []string
|
||||
tmp := strings.Split(tag, ",")
|
||||
for _, t := range tmp {
|
||||
t = util.RemoveInvalid(t)
|
||||
t = strings.TrimSpace(t)
|
||||
if "" != t {
|
||||
tags = append(tags, t)
|
||||
}
|
||||
}
|
||||
tags = gulu.Str.RemoveDuplicatedElem(tags)
|
||||
if 0 < len(tags) {
|
||||
nameValues["tags"] = strings.Join(tags, ",")
|
||||
}
|
||||
}
|
||||
|
||||
for name, value := range nameValues {
|
||||
value = util.RemoveInvalid(value)
|
||||
value = strings.TrimSpace(value)
|
||||
|
|
Loading…
Add table
Reference in a new issue