mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +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
d51b336183
commit
20cd3c5f80
2 changed files with 43 additions and 0 deletions
|
|
@ -885,6 +885,47 @@ func removeAttributeViewColumn(operation *Operation) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tx *Transaction) doReplaceAttrViewBlock(operation *Operation) (ret *TxErr) {
|
||||||
|
err := replaceAttributeViewBlock(operation)
|
||||||
|
if nil != err {
|
||||||
|
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func replaceAttributeViewBlock(operation *Operation) (err error) {
|
||||||
|
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||||
|
if nil != err {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, keyValues := range attrView.KeyValues {
|
||||||
|
for _, value := range keyValues.Values {
|
||||||
|
if value.BlockID == operation.PreviousID {
|
||||||
|
value.BlockID = operation.NextID
|
||||||
|
if nil != value.Block {
|
||||||
|
value.Block.ID = operation.NextID
|
||||||
|
value.IsDetached = operation.IsDetached
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range attrView.Views {
|
||||||
|
switch v.LayoutType {
|
||||||
|
case av.LayoutTypeTable:
|
||||||
|
for i, rowID := range v.Table.RowIDs {
|
||||||
|
if rowID == operation.PreviousID {
|
||||||
|
v.Table.RowIDs[i] = operation.NextID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = av.SaveAttributeView(attrView)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {
|
||||||
err := updateAttributeViewCell(operation, tx)
|
err := updateAttributeViewCell(operation, tx)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
||||||
ret = tx.doSetAttrViewColCalc(op)
|
ret = tx.doSetAttrViewColCalc(op)
|
||||||
case "updateAttrViewColNumberFormat":
|
case "updateAttrViewColNumberFormat":
|
||||||
ret = tx.doUpdateAttrViewColNumberFormat(op)
|
ret = tx.doUpdateAttrViewColNumberFormat(op)
|
||||||
|
case "replaceAttrViewBlock":
|
||||||
|
ret = tx.doReplaceAttrViewBlock(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != ret {
|
if nil != ret {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue