1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 12:14:14 +02:00

fix softbreak at the end of the leaf (#2389)

This commit is contained in:
Irwan Fario Subastian
2018-11-07 13:25:51 +11:00
committed by Ian Storm Taylor
parent 312a4ce1a5
commit 8d616b1f98

View File

@@ -175,7 +175,8 @@ class Leaf extends React.Component {
const lastChar = text.charAt(text.length - 1)
const isLastText = node === lastText
const isLastLeaf = index === leaves.size - 1
if (isLastText && isLastLeaf && lastChar === '\n') return `${text}\n`
if (isLastText && isLastLeaf && lastChar === '\n')
return <span data-slate-content>{`${text}\n`}</span>
// Otherwise, just return the content.
return <span data-slate-content>{text}</span>