An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: New a row in the database no longer require to create a relevant doc https://github.com/siyuan-note/siyuan/issues/9294
Daniel863eb5e5703d
diff --git a/kernel/av/av.go b/kernel/av/av.goindex 602e964101..2d50e2848e 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -94,10 +94,11 @@ type KeySelectOption struct {}type Value struct {- ID string `json:"id,omitempty"`- KeyID string `json:"keyID,omitempty"`- BlockID string `json:"blockID,omitempty"`- Type KeyType `json:"type,omitempty"`+ ID string `json:"id,omitempty"`+ KeyID string `json:"keyID,omitempty"`+ BlockID string `json:"blockID,omitempty"`+ Type KeyType `json:"type,omitempty"`+ IsDetached bool `json:"isDetached,omitempty"`Block *ValueBlock `json:"block,omitempty"`Text *ValueText `json:"text,omitempty"`diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex e8d23ab307..8fe9069179 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -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 {diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex 90efbf22cf..18c455cf3f 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -1099,13 +1099,14 @@ type Operation struct {DeckID string `json:"deckID"` // 用于添加/删除闪卡- AvID string `json:"avID"` // 属性视图 ID- SrcIDs []string `json:"srcIDs"` // 用于将块拖拽到属性视图中- Name string `json:"name"` // 属性视图列名- Typ string `json:"type"` // 属性视图列类型- Format string `json:"format"` // 属性视图列格式化- KeyID string `json:"keyID"` // 属性视列 ID- RowID string `json:"rowID"` // 属性视图行 ID+ AvID string `json:"avID"` // 属性视图 ID+ SrcIDs []string `json:"srcIDs"` // 用于将块拖拽到属性视图中+ IsDetached bool `json:"isDetached"` // 用于标识是否是脱离块,仅存在于属性视图中+ Name string `json:"name"` // 属性视图列名+ Typ string `json:"type"` // 属性视图列类型+ Format string `json:"format"` // 属性视图列格式化+ KeyID string `json:"keyID"` // 属性视列 ID+ RowID string `json:"rowID"` // 属性视图行 IDdiscard bool // 用于标识是否在事务合并中丢弃}