mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Browser clipping extension supports configuring document tags https://github.com/siyuan-note/siyuan/issues/10797
This commit is contained in:
parent
d4133473a4
commit
2472c63177
2 changed files with 21 additions and 2 deletions
|
|
@ -673,6 +673,12 @@ func createDocWithMd(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tagsArg := arg["tags"]
|
||||||
|
var tags string
|
||||||
|
if nil != tagsArg {
|
||||||
|
tags = tagsArg.(string)
|
||||||
|
}
|
||||||
|
|
||||||
var parentID string
|
var parentID string
|
||||||
parentIDArg := arg["parentID"]
|
parentIDArg := arg["parentID"]
|
||||||
if nil != parentIDArg {
|
if nil != parentIDArg {
|
||||||
|
|
@ -706,7 +712,7 @@ func createDocWithMd(c *gin.Context) {
|
||||||
withMath = withMathArg.(bool)
|
withMath = withMathArg.(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, id, withMath)
|
id, err := model.CreateWithMarkdown(tags, notebook, hPath, markdown, parentID, id, withMath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
|
|
|
||||||
|
|
@ -1159,7 +1159,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateWithMarkdown(boxID, hPath, md, parentID, id string, withMath bool) (retID string, err error) {
|
func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bool) (retID string, err error) {
|
||||||
createDocLock.Lock()
|
createDocLock.Lock()
|
||||||
defer createDocLock.Unlock()
|
defer createDocLock.Unlock()
|
||||||
|
|
||||||
|
|
@ -1177,6 +1177,19 @@ func CreateWithMarkdown(boxID, hPath, md, parentID, id string, withMath bool) (r
|
||||||
luteEngine.SetHTMLTag2TextMark(true)
|
luteEngine.SetHTMLTag2TextMark(true)
|
||||||
dom := luteEngine.Md2BlockDOM(md, false)
|
dom := luteEngine.Md2BlockDOM(md, false)
|
||||||
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
|
retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
|
||||||
|
|
||||||
|
nameValues := map[string]string{}
|
||||||
|
tags = strings.TrimSpace(tags)
|
||||||
|
tags = strings.ReplaceAll(tags, ",", ",")
|
||||||
|
tagArray := strings.Split(tags, ",")
|
||||||
|
var tmp []string
|
||||||
|
for _, tag := range tagArray {
|
||||||
|
tmp = append(tmp, strings.TrimSpace(tag))
|
||||||
|
}
|
||||||
|
tags = strings.Join(tmp, ",")
|
||||||
|
nameValues["tags"] = tags
|
||||||
|
SetBlockAttrs(retID, nameValues)
|
||||||
|
|
||||||
WaitForWritingFiles()
|
WaitForWritingFiles()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue