Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Daniel4cc2d9a6a864
diff --git a/kernel/api/av.go b/kernel/api/av.go
index 4f3407b09e..58fe3c2c67 100644
--- a/kernel/api/av.go
+++ b/kernel/api/av.go
@@ -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()
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index ee332b4b1b..97190c5487 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -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)
}