Skip to content

Commit d7124e5

Browse files
committed
🎨 Protyle Improve soft line break paste parsing siyuan-note/siyuan#14481
1 parent 216bec0 commit d7124e5

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

javascript/lute.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascript/lute.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protyle.go

+7
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,13 @@ func (lute *Lute) genASTContenteditable(n *html.Node, tree *parse.Tree) {
16181618
if nil != n.PrevSibling && "\n" == n.PrevSibling.Data && lute.parentIs(n, atom.Table) {
16191619
return
16201620
}
1621+
if ast.NodeParagraph == tree.Context.Tip.Type {
1622+
// 将硬换行转换为软换行 https://github.com/siyuan-note/siyuan/issues/14481
1623+
node.Type = ast.NodeText
1624+
node.Tokens = []byte("\n")
1625+
tree.Context.Tip.AppendChild(node)
1626+
return
1627+
}
16211628

16221629
node.Type = ast.NodeBr
16231630
tree.Context.Tip.AppendChild(node)

0 commit comments

Comments
 (0)