🎨 Improve document tag adding interaction https://github.com/siyuan-note/siyuan/issues/13311

This commit is contained in:
Daniel 2024-12-11 20:22:36 +08:00
parent a5363fa0b4
commit 922f9fe075
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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)