mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 22:21:28 +08:00
This commit is contained in:
parent
f0d4d7ed4b
commit
6eb5830d75
@ -73,7 +73,23 @@ func (tx *Transaction) doRemoveAttrViewBlock(operation *Operation) (ret *TxErr)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddAttributeViewColumn(name string, typ string, columnIndex int, avID string) (err error) {
|
func (tx *Transaction) doAddAttrViewColumn(operation *Operation) (ret *TxErr) {
|
||||||
|
err := addAttributeViewColumn(operation.Name, operation.Typ, 1024, operation.ParentID)
|
||||||
|
if nil != err {
|
||||||
|
return &TxErr{code: TxErrWriteAttributeView, id: operation.ParentID, msg: err.Error()}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tx *Transaction) doRemoveAttrViewColumn(operation *Operation) (ret *TxErr) {
|
||||||
|
err := removeAttributeViewColumn(operation.ID, operation.ParentID)
|
||||||
|
if nil != err {
|
||||||
|
return &TxErr{code: TxErrWriteAttributeView, id: operation.ParentID, msg: err.Error()}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func addAttributeViewColumn(name string, typ string, columnIndex int, avID string) (err error) {
|
||||||
attrView, err := av.ParseAttributeView(avID)
|
attrView, err := av.ParseAttributeView(avID)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
@ -93,7 +109,7 @@ func AddAttributeViewColumn(name string, typ string, columnIndex int, avID strin
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveAttributeViewColumn(columnID string, avID string) (err error) {
|
func removeAttributeViewColumn(columnID string, avID string) (err error) {
|
||||||
attrView, err := av.ParseAttributeView(avID)
|
attrView, err := av.ParseAttributeView(avID)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
@ -218,6 +218,10 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
|||||||
ret = tx.doInsertAttrViewBlock(op)
|
ret = tx.doInsertAttrViewBlock(op)
|
||||||
case "removeAttrViewBlock":
|
case "removeAttrViewBlock":
|
||||||
ret = tx.doRemoveAttrViewBlock(op)
|
ret = tx.doRemoveAttrViewBlock(op)
|
||||||
|
case "addAttrViewCol":
|
||||||
|
ret = tx.doAddAttrViewColumn(op)
|
||||||
|
case "removeAttrViewCol":
|
||||||
|
ret = tx.doRemoveAttrViewColumn(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != ret {
|
if nil != ret {
|
||||||
@ -1026,9 +1030,12 @@ type Operation struct {
|
|||||||
ParentID string `json:"parentID"`
|
ParentID string `json:"parentID"`
|
||||||
PreviousID string `json:"previousID"`
|
PreviousID string `json:"previousID"`
|
||||||
NextID string `json:"nextID"`
|
NextID string `json:"nextID"`
|
||||||
SrcIDs []string `json:"srcIDs"` // 用于将块拖拽到属性视图中
|
|
||||||
RetData interface{} `json:"retData"`
|
RetData interface{} `json:"retData"`
|
||||||
|
|
||||||
|
SrcIDs []string `json:"srcIDs"` // 用于将块拖拽到属性视图中
|
||||||
|
Name string `json:"name"` // 用于属性视图列名
|
||||||
|
Typ string `json:"type"` // 用于属性视图列类型
|
||||||
|
|
||||||
discard bool // 用于标识是否在事务合并中丢弃
|
discard bool // 用于标识是否在事务合并中丢弃
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user