🎨 Supports specifying the notebook to save new docs https://github.com/siyuan-note/siyuan/issues/10671
This commit is contained in:
parent
882883a9cc
commit
f0fd493c4e
3 changed files with 31 additions and 8 deletions
|
@ -704,10 +704,18 @@ func getDocCreateSavePath(c *gin.Context) {
|
|||
|
||||
notebook := arg["notebook"].(string)
|
||||
box := model.Conf.Box(notebook)
|
||||
var docCreateSaveBox string
|
||||
docCreateSavePathTpl := model.Conf.FileTree.DocCreateSavePath
|
||||
if nil != box {
|
||||
docCreateSaveBox = box.GetConf().DocCreateSaveBox
|
||||
docCreateSavePathTpl = box.GetConf().DocCreateSavePath
|
||||
}
|
||||
if "" == docCreateSaveBox {
|
||||
docCreateSaveBox = model.Conf.FileTree.DocCreateSaveBox
|
||||
}
|
||||
if "" == docCreateSaveBox {
|
||||
docCreateSaveBox = notebook
|
||||
}
|
||||
if "" == docCreateSavePathTpl {
|
||||
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
||||
}
|
||||
|
@ -719,14 +727,16 @@ func getDocCreateSavePath(c *gin.Context) {
|
|||
docCreateSavePathTpl = "/Untitled"
|
||||
}
|
||||
|
||||
p, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||
docCreateSavePath, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"path": p,
|
||||
"box": docCreateSaveBox,
|
||||
"path": docCreateSavePath,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,22 +751,31 @@ func getRefCreateSavePath(c *gin.Context) {
|
|||
|
||||
notebook := arg["notebook"].(string)
|
||||
box := model.Conf.Box(notebook)
|
||||
refCreateSavePath := model.Conf.FileTree.RefCreateSavePath
|
||||
var refCreateSaveBox string
|
||||
refCreateSavePathTpl := model.Conf.FileTree.RefCreateSavePath
|
||||
if nil != box {
|
||||
refCreateSavePath = box.GetConf().RefCreateSavePath
|
||||
refCreateSaveBox = box.GetConf().RefCreateSaveBox
|
||||
refCreateSavePathTpl = box.GetConf().RefCreateSavePath
|
||||
}
|
||||
if "" == refCreateSavePath {
|
||||
refCreateSavePath = model.Conf.FileTree.RefCreateSavePath
|
||||
if "" == refCreateSaveBox {
|
||||
refCreateSaveBox = model.Conf.FileTree.RefCreateSaveBox
|
||||
}
|
||||
if "" == refCreateSaveBox {
|
||||
refCreateSaveBox = notebook
|
||||
}
|
||||
if "" == refCreateSavePathTpl {
|
||||
refCreateSavePathTpl = model.Conf.FileTree.RefCreateSavePath
|
||||
}
|
||||
|
||||
p, err := model.RenderGoTemplate(refCreateSavePath)
|
||||
refCreateSavePath, err := model.RenderGoTemplate(refCreateSavePathTpl)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = map[string]interface{}{
|
||||
"path": p,
|
||||
"box": refCreateSaveBox,
|
||||
"path": refCreateSavePath,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ type BoxConf struct {
|
|||
Sort int `json:"sort"` // 排序字段
|
||||
Icon string `json:"icon"` // 图标
|
||||
Closed bool `json:"closed"` // 是否处于关闭状态
|
||||
RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本
|
||||
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
||||
DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本
|
||||
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
||||
DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径
|
||||
DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径
|
||||
|
|
|
@ -23,7 +23,9 @@ import (
|
|||
type FileTree struct {
|
||||
AlwaysSelectOpenedFile bool `json:"alwaysSelectOpenedFile"` // 是否自动选中当前打开的文件
|
||||
OpenFilesUseCurrentTab bool `json:"openFilesUseCurrentTab"` // 在当前页签打开文件
|
||||
RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本
|
||||
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
||||
DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本
|
||||
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
||||
MaxListCount int `json:"maxListCount"` // 最大列出数量
|
||||
MaxOpenTabCount int `json:"maxOpenTabCount"` // 最大打开页签数量
|
||||
|
|
Loading…
Add table
Reference in a new issue