mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 20:38:49 +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
85aca5230e
commit
863eb5e570
3 changed files with 23 additions and 15 deletions
|
|
@ -171,8 +171,12 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
}
|
||||
|
||||
// 过滤掉不存在的行
|
||||
notFound := []string{}
|
||||
for blockID, _ := range rows {
|
||||
var notFound []string
|
||||
for blockID, v := range rows {
|
||||
if v[0].IsDetached {
|
||||
continue
|
||||
}
|
||||
|
||||
if treenode.GetBlockTree(blockID) == nil {
|
||||
notFound = append(notFound, blockID)
|
||||
}
|
||||
|
|
@ -417,7 +421,7 @@ func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr)
|
|||
|
||||
func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tree, tx *Transaction) (err error) {
|
||||
var node *ast.Node
|
||||
if "" != blockID {
|
||||
if !operation.IsDetached {
|
||||
node = treenode.GetNodeInTree(tree, blockID)
|
||||
if nil == node {
|
||||
err = ErrBlockNotFound
|
||||
|
|
@ -428,6 +432,8 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
|
|||
// 不能将一个属性视图拖拽到另一个属性视图中
|
||||
return
|
||||
}
|
||||
} else {
|
||||
blockID = ast.NewNodeID()
|
||||
}
|
||||
|
||||
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||
|
|
@ -448,7 +454,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, 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)
|
||||
|
||||
if nil != node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue