mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
bf9721bf40
commit
feef48d624
1 changed files with 13 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue