mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 New a row in the database no longer require to create a relevant doc https://github.com/siyuan-note/siyuan/issues/9294
This commit is contained in:
parent
863eb5e570
commit
0b1608d2c3
1 changed files with 2 additions and 12 deletions
|
|
@ -394,19 +394,9 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr) {
|
||||||
if 1 > len(operation.SrcIDs) {
|
|
||||||
// 不绑定到任何块的情况,比如直接在属性视图中添加一个块
|
|
||||||
// New a row in the database no longer require to create a relevant doc https://github.com/siyuan-note/siyuan/issues/9294
|
|
||||||
var avErr error
|
|
||||||
if avErr = addAttributeViewBlock("", operation, nil, tx); nil != avErr {
|
|
||||||
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: avErr.Error()}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, id := range operation.SrcIDs {
|
for _, id := range operation.SrcIDs {
|
||||||
tree, err := tx.loadTree(id)
|
tree, err := tx.loadTree(id)
|
||||||
if nil != err {
|
if nil != err && !operation.IsDetached {
|
||||||
logging.LogErrorf("load tree [%s] failed: %s", id, err)
|
logging.LogErrorf("load tree [%s] failed: %s", id, err)
|
||||||
return &TxErr{code: TxErrCodeBlockNotFound, id: id, msg: err.Error()}
|
return &TxErr{code: TxErrCodeBlockNotFound, id: id, msg: err.Error()}
|
||||||
}
|
}
|
||||||
|
|
@ -457,7 +447,7 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
|
||||||
value := &av.Value{ID: ast.NewNodeID(), KeyID: blockValues.Key.ID, BlockID: blockID, Type: av.KeyTypeBlock, IsDetached: operation.IsDetached, Block: &av.ValueBlock{ID: blockID, Content: getNodeRefText(node)}}
|
value := &av.Value{ID: ast.NewNodeID(), KeyID: blockValues.Key.ID, BlockID: blockID, Type: av.KeyTypeBlock, IsDetached: operation.IsDetached, Block: &av.ValueBlock{ID: blockID, Content: getNodeRefText(node)}}
|
||||||
blockValues.Values = append(blockValues.Values, value)
|
blockValues.Values = append(blockValues.Values, value)
|
||||||
|
|
||||||
if nil != node {
|
if !operation.IsDetached {
|
||||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
|
|
||||||
if "" == attrs[NodeAttrNameAvs] {
|
if "" == attrs[NodeAttrNameAvs] {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue