mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
fix softbreak at the end of the leaf (#2389)
This commit is contained in:
committed by
Ian Storm Taylor
parent
312a4ce1a5
commit
8d616b1f98
@@ -175,7 +175,8 @@ class Leaf extends React.Component {
|
|||||||
const lastChar = text.charAt(text.length - 1)
|
const lastChar = text.charAt(text.length - 1)
|
||||||
const isLastText = node === lastText
|
const isLastText = node === lastText
|
||||||
const isLastLeaf = index === leaves.size - 1
|
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.
|
// Otherwise, just return the content.
|
||||||
return <span data-slate-content>{text}</span>
|
return <span data-slate-content>{text}</span>
|
||||||
|
Reference in New Issue
Block a user