🎨 Supports specifying the notebook to save new docs https://github.com/siyuan-note/siyuan/issues/10671
This commit is contained in:
parent
62697aa940
commit
78216e7909
1 changed files with 16 additions and 0 deletions
|
@ -716,6 +716,7 @@ func getDocCreateSavePath(c *gin.Context) {
|
|||
}
|
||||
if "" != docCreateSaveBox {
|
||||
if nil == model.Conf.Box(docCreateSaveBox) {
|
||||
// 如果配置的笔记本未打开或者不存在,则使用当前笔记本
|
||||
docCreateSaveBox = notebook
|
||||
}
|
||||
}
|
||||
|
@ -733,6 +734,13 @@ func getDocCreateSavePath(c *gin.Context) {
|
|||
docCreateSavePathTpl = "/Untitled"
|
||||
}
|
||||
|
||||
if docCreateSaveBox != notebook {
|
||||
if "" != docCreateSavePathTpl && !strings.HasPrefix(docCreateSavePathTpl, "/") {
|
||||
// 如果配置的笔记本不是当前笔记本,则将相对路径转换为绝对路径
|
||||
docCreateSavePathTpl = "/" + docCreateSavePathTpl
|
||||
}
|
||||
}
|
||||
|
||||
docCreateSavePath, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
|
@ -769,6 +777,7 @@ func getRefCreateSavePath(c *gin.Context) {
|
|||
}
|
||||
if "" != refCreateSaveBox {
|
||||
if nil == model.Conf.Box(refCreateSaveBox) {
|
||||
// 如果配置的笔记本未打开或者不存在,则使用当前笔记本
|
||||
refCreateSaveBox = notebook
|
||||
}
|
||||
}
|
||||
|
@ -779,6 +788,13 @@ func getRefCreateSavePath(c *gin.Context) {
|
|||
refCreateSavePathTpl = model.Conf.FileTree.RefCreateSavePath
|
||||
}
|
||||
|
||||
if refCreateSaveBox != notebook {
|
||||
if "" != refCreateSavePathTpl && !strings.HasPrefix(refCreateSavePathTpl, "/") {
|
||||
// 如果配置的笔记本不是当前笔记本,则将相对路径转换为绝对路径
|
||||
refCreateSavePathTpl = "/" + refCreateSavePathTpl
|
||||
}
|
||||
}
|
||||
|
||||
refCreateSavePath, err := model.RenderGoTemplate(refCreateSavePathTpl)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
|
|
Loading…
Add table
Reference in a new issue