mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-23 00:36:10 +01:00
🎨 Shallow clone the corresponding database when the template contains database blocks https://github.com/siyuan-note/siyuan/issues/9494
This commit is contained in:
parent
7145460c18
commit
8ad15c4d23
3 changed files with 14 additions and 7 deletions
|
|
@ -164,11 +164,11 @@ func DocSaveAsTemplate(id, name string, overwrite bool) (code int, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func RenderTemplate(p, id string) (string, error) {
|
||||
return renderTemplate(p, id)
|
||||
func RenderTemplate(p, id string, preview bool) (string, error) {
|
||||
return renderTemplate(p, id, preview)
|
||||
}
|
||||
|
||||
func renderTemplate(p, id string) (string, error) {
|
||||
func renderTemplate(p, id string, preview bool) (string, error) {
|
||||
tree, err := loadTreeByBlockID(id)
|
||||
if nil != err {
|
||||
return "", err
|
||||
|
|
@ -288,8 +288,10 @@ func renderTemplate(p, id string) (string, error) {
|
|||
cloned := av.CloneAttributeView(attrView)
|
||||
if nil != cloned {
|
||||
n.AttributeViewID = cloned.ID
|
||||
if saveErr := av.SaveAttributeView(cloned); nil != saveErr {
|
||||
logging.LogErrorf("save attribute view [%s] failed: %s", cloned.ID, saveErr)
|
||||
if !preview {
|
||||
if saveErr := av.SaveAttributeView(cloned); nil != saveErr {
|
||||
logging.LogErrorf("save attribute view [%s] failed: %s", cloned.ID, saveErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue