mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Database gallery view https://github.com/siyuan-note/siyuan/issues/10414
This commit is contained in:
parent
0b24f4fee1
commit
9f188cd6ac
1 changed files with 14 additions and 14 deletions
|
|
@ -1627,20 +1627,6 @@ func (tx *Transaction) doAddAttrViewView(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrWriteAttributeView, id: avID}
|
||||
}
|
||||
|
||||
node, tree, _ := getNodeByBlockID(nil, operation.BlockID)
|
||||
if nil == node {
|
||||
logging.LogErrorf("get node by block ID [%s] failed", operation.BlockID)
|
||||
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID}
|
||||
}
|
||||
|
||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||
attrs[av.NodeAttrView] = operation.ID
|
||||
err = setNodeAttrs(node, tree, attrs)
|
||||
if err != nil {
|
||||
logging.LogWarnf("set node [%s] attrs failed: %s", operation.BlockID, err)
|
||||
return
|
||||
}
|
||||
|
||||
if "" == operation.Layout {
|
||||
operation.Layout = av.LayoutTypeTable
|
||||
}
|
||||
|
|
@ -1692,7 +1678,21 @@ func (tx *Transaction) doAddAttrViewView(operation *Operation) (ret *TxErr) {
|
|||
view.ID = operation.ID
|
||||
attrView.Views = append(attrView.Views, view)
|
||||
attrView.ViewID = view.ID
|
||||
|
||||
node, tree, _ := getNodeByBlockID(nil, operation.BlockID)
|
||||
if nil == node {
|
||||
logging.LogErrorf("get node by block ID [%s] failed", operation.BlockID)
|
||||
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID}
|
||||
}
|
||||
|
||||
node.AttributeViewType = string(view.LayoutType)
|
||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||
attrs[av.NodeAttrView] = operation.ID
|
||||
err = setNodeAttrs(node, tree, attrs)
|
||||
if err != nil {
|
||||
logging.LogWarnf("set node [%s] attrs failed: %s", operation.BlockID, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = av.SaveAttributeView(attrView); err != nil {
|
||||
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue