mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🎨 Improve av grouping https://github.com/siyuan-note/siyuan/issues/15429
This commit is contained in:
parent
3c6ce60525
commit
6c0eed5d09
2 changed files with 33 additions and 0 deletions
|
|
@ -302,6 +302,37 @@ func hideAttributeViewGroup(avID, blockID, groupID string, hidden int) (err erro
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tx *Transaction) doHideAttrViewAllGroups(operation *Operation) (ret *TxErr) {
|
||||||
|
if err := hideAttributeViewAllGroups(operation.AvID, operation.BlockID, int(operation.Data.(float64))); nil != err {
|
||||||
|
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func hideAttributeViewAllGroups(avID, blockID string, hidden int) (err error) {
|
||||||
|
attrView, err := av.ParseAttributeView(avID)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
view, err := getAttrViewViewByBlockID(attrView, blockID)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, group := range view.Groups {
|
||||||
|
group.GroupHidden = hidden
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
err = av.SaveAttributeView(attrView)
|
||||||
|
if err != nil {
|
||||||
|
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doFoldAttrViewGroup(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doFoldAttrViewGroup(operation *Operation) (ret *TxErr) {
|
||||||
if err := foldAttrViewGroup(operation.AvID, operation.BlockID, operation.ID, operation.Data.(bool)); nil != err {
|
if err := foldAttrViewGroup(operation.AvID, operation.BlockID, operation.ID, operation.Data.(bool)); nil != err {
|
||||||
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
||||||
ret = tx.doSetAttrViewGroup(op)
|
ret = tx.doSetAttrViewGroup(op)
|
||||||
case "hideAttrViewGroup":
|
case "hideAttrViewGroup":
|
||||||
ret = tx.doHideAttrViewGroup(op)
|
ret = tx.doHideAttrViewGroup(op)
|
||||||
|
case "hideAttrViewAllGroups":
|
||||||
|
ret = tx.doHideAttrViewAllGroups(op)
|
||||||
case "foldAttrViewGroup":
|
case "foldAttrViewGroup":
|
||||||
ret = tx.doFoldAttrViewGroup(op)
|
ret = tx.doFoldAttrViewGroup(op)
|
||||||
case "syncAttrViewTableColWidth":
|
case "syncAttrViewTableColWidth":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue