🎨 Rows non-bound in the database support Add to Database https://github.com/siyuan-note/siyuan/issues/11093

This commit is contained in:
Daniel 2024-04-20 11:12:49 +08:00
parent 68549c5c81
commit 4cc2d9a6a8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 9 additions and 6 deletions

View file

@ -127,8 +127,12 @@ func addAttributeViewValues(c *gin.Context) {
if nil != arg["ignoreFillFilter"] {
ignoreFillFilter = arg["ignoreFillFilter"].(bool)
}
var content string
if nil != arg["content"] {
content = arg["content"].(string)
}
err := model.AddAttributeViewBlock(nil, srcIDs, avID, blockID, previousID, isDetached, ignoreFillFilter)
err := model.AddAttributeViewBlock(nil, srcIDs, avID, blockID, previousID, content, isDetached, ignoreFillFilter)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()

View file

@ -2165,14 +2165,14 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) {
}
func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr) {
err := AddAttributeViewBlock(tx, operation.SrcIDs, operation.AvID, operation.BlockID, operation.PreviousID, operation.IsDetached, operation.IgnoreFillFilterVal)
err := AddAttributeViewBlock(tx, operation.SrcIDs, operation.AvID, operation.BlockID, operation.PreviousID, operation.Name, operation.IsDetached, operation.IgnoreFillFilterVal)
if nil != err {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func AddAttributeViewBlock(tx *Transaction, srcIDs []string, avID, blockID, previousBlockID string, isDetached, ignoreFillFilter bool) (err error) {
func AddAttributeViewBlock(tx *Transaction, srcIDs []string, avID, blockID, previousBlockID, content string, isDetached, ignoreFillFilter bool) (err error) {
for _, id := range srcIDs {
var tree *parse.Tree
if !isDetached {
@ -2188,14 +2188,14 @@ func AddAttributeViewBlock(tx *Transaction, srcIDs []string, avID, blockID, prev
}
}
if avErr := addAttributeViewBlock(avID, blockID, previousBlockID, id, isDetached, ignoreFillFilter, tree, tx); nil != avErr {
if avErr := addAttributeViewBlock(avID, blockID, previousBlockID, id, content, isDetached, ignoreFillFilter, tree, tx); nil != avErr {
return avErr
}
}
return
}
func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string, isDetached, ignoreFillFilter bool, tree *parse.Tree, tx *Transaction) (err error) {
func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID, content string, isDetached, ignoreFillFilter bool, tree *parse.Tree, tx *Transaction) (err error) {
var node *ast.Node
if !isDetached {
node = treenode.GetNodeInTree(tree, addingBlockID)
@ -2215,7 +2215,6 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
return
}
var content string
if !isDetached {
content = getNodeRefText(node)
}