mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 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)
|
notebook := arg["notebook"].(string)
|
||||||
box := model.Conf.Box(notebook)
|
box := model.Conf.Box(notebook)
|
||||||
|
var docCreateSaveBox string
|
||||||
docCreateSavePathTpl := model.Conf.FileTree.DocCreateSavePath
|
docCreateSavePathTpl := model.Conf.FileTree.DocCreateSavePath
|
||||||
if nil != box {
|
if nil != box {
|
||||||
|
docCreateSaveBox = box.GetConf().DocCreateSaveBox
|
||||||
docCreateSavePathTpl = box.GetConf().DocCreateSavePath
|
docCreateSavePathTpl = box.GetConf().DocCreateSavePath
|
||||||
}
|
}
|
||||||
|
if "" == docCreateSaveBox {
|
||||||
|
docCreateSaveBox = model.Conf.FileTree.DocCreateSaveBox
|
||||||
|
}
|
||||||
|
if "" == docCreateSaveBox {
|
||||||
|
docCreateSaveBox = notebook
|
||||||
|
}
|
||||||
if "" == docCreateSavePathTpl {
|
if "" == docCreateSavePathTpl {
|
||||||
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
||||||
}
|
}
|
||||||
|
|
@ -719,14 +727,16 @@ func getDocCreateSavePath(c *gin.Context) {
|
||||||
docCreateSavePathTpl = "/Untitled"
|
docCreateSavePathTpl = "/Untitled"
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
docCreateSavePath, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"path": p,
|
"box": docCreateSaveBox,
|
||||||
|
"path": docCreateSavePath,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -741,22 +751,31 @@ func getRefCreateSavePath(c *gin.Context) {
|
||||||
|
|
||||||
notebook := arg["notebook"].(string)
|
notebook := arg["notebook"].(string)
|
||||||
box := model.Conf.Box(notebook)
|
box := model.Conf.Box(notebook)
|
||||||
refCreateSavePath := model.Conf.FileTree.RefCreateSavePath
|
var refCreateSaveBox string
|
||||||
|
refCreateSavePathTpl := model.Conf.FileTree.RefCreateSavePath
|
||||||
if nil != box {
|
if nil != box {
|
||||||
refCreateSavePath = box.GetConf().RefCreateSavePath
|
refCreateSaveBox = box.GetConf().RefCreateSaveBox
|
||||||
|
refCreateSavePathTpl = box.GetConf().RefCreateSavePath
|
||||||
}
|
}
|
||||||
if "" == refCreateSavePath {
|
if "" == refCreateSaveBox {
|
||||||
refCreateSavePath = model.Conf.FileTree.RefCreateSavePath
|
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 {
|
if nil != err {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"path": p,
|
"box": refCreateSaveBox,
|
||||||
|
"path": refCreateSavePath,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ type BoxConf struct {
|
||||||
Sort int `json:"sort"` // 排序字段
|
Sort int `json:"sort"` // 排序字段
|
||||||
Icon string `json:"icon"` // 图标
|
Icon string `json:"icon"` // 图标
|
||||||
Closed bool `json:"closed"` // 是否处于关闭状态
|
Closed bool `json:"closed"` // 是否处于关闭状态
|
||||||
|
RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本
|
||||||
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
||||||
|
DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本
|
||||||
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
||||||
DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径
|
DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径
|
||||||
DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径
|
DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ import (
|
||||||
type FileTree struct {
|
type FileTree struct {
|
||||||
AlwaysSelectOpenedFile bool `json:"alwaysSelectOpenedFile"` // 是否自动选中当前打开的文件
|
AlwaysSelectOpenedFile bool `json:"alwaysSelectOpenedFile"` // 是否自动选中当前打开的文件
|
||||||
OpenFilesUseCurrentTab bool `json:"openFilesUseCurrentTab"` // 在当前页签打开文件
|
OpenFilesUseCurrentTab bool `json:"openFilesUseCurrentTab"` // 在当前页签打开文件
|
||||||
|
RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本
|
||||||
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径
|
||||||
|
DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本
|
||||||
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
||||||
MaxListCount int `json:"maxListCount"` // 最大列出数量
|
MaxListCount int `json:"maxListCount"` // 最大列出数量
|
||||||
MaxOpenTabCount int `json:"maxOpenTabCount"` // 最大打开页签数量
|
MaxOpenTabCount int `json:"maxOpenTabCount"` // 最大打开页签数量
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue