mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 21:38:48 +01:00
✨ 增加公共代码 js/css 片段 https://github.com/siyuan-note/siyuan/issues/6143
This commit is contained in:
parent
75a173a6fd
commit
ee413a6352
1 changed files with 14 additions and 14 deletions
|
|
@ -667,20 +667,20 @@ func loadSnippets() {
|
|||
Snippets = []*conf.Snippet{}
|
||||
|
||||
confPath := filepath.Join(util.DataDir, "snippets/conf.json")
|
||||
var data []byte
|
||||
var err error
|
||||
|
||||
if gulu.File.IsExist(confPath) {
|
||||
data, err = filelock.ReadFile(confPath)
|
||||
if nil != err {
|
||||
logging.LogErrorf("load js snippets failed: %s", err)
|
||||
} else {
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &Snippets); nil != err {
|
||||
logging.LogErrorf("unmarshal js snippets failed: %s", err)
|
||||
} else {
|
||||
logging.LogInfof("loaded js snippets [%d]", len(Snippets))
|
||||
}
|
||||
}
|
||||
if !gulu.File.IsExist(confPath) {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := filelock.ReadFile(confPath)
|
||||
if nil != err {
|
||||
logging.LogErrorf("load js snippets failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &Snippets); nil != err {
|
||||
logging.LogErrorf("unmarshal js snippets failed: %s", err)
|
||||
return
|
||||
}
|
||||
logging.LogInfof("loaded js snippets [%d]", len(Snippets))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue