diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index d2793445d..f90868e69 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -180,15 +180,11 @@ func (tx *Transaction) doHideAttrViewGroup(operation *Operation) (ret *TxErr) { func hideAttributeViewGroup(avID, blockID, groupID string, hidden int) (err error) { attrView, err := av.ParseAttributeView(avID) if err != nil { - return err + return } view, err := getAttrViewViewByBlockID(attrView, blockID) if err != nil { - return err - } - - if nil == view.Group { return } @@ -202,9 +198,9 @@ func hideAttributeViewGroup(avID, blockID, groupID string, hidden int) (err erro err = av.SaveAttributeView(attrView) if err != nil { logging.LogErrorf("save attribute view [%s] failed: %s", avID, err) - return err + return } - return nil + return } func (tx *Transaction) doFoldAttrViewGroup(operation *Operation) (ret *TxErr) { diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 0734a05eb..0f65692a2 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1440,6 +1440,19 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) { cache.PutBlockIAL(updatedNode.ID, parse.IAL2Map(updatedNode.KramdownIAL)) + if ast.NodeHTMLBlock == updatedNode.Type { + content := string(updatedNode.Tokens) + // 剔除连续的空行(包括空行内包含空格的情况) https://github.com/siyuan-note/siyuan/issues/15377 + var newLines []string + lines := strings.Split(content, "\n") + for _, line := range lines { + if strings.TrimSpace(line) != "" { + newLines = append(newLines, line) + } + } + updatedNode.Tokens = []byte(strings.Join(newLines, "\n")) + } + // 替换为新节点 oldNode.InsertAfter(updatedNode) oldNode.Unlink()