1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 13:51:59 +02:00

Normalization: Nonempty to empty to inline should remove empty node (#4458)

* Normalization: Nonempty to empty to inline should remove empty node

* Fix lint
This commit is contained in:
Tim 2021-08-21 03:55:28 -07:00 committed by GitHub
parent ace397f966
commit 95c759a19c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'slate': patch
---
Normalization now removes empty text nodes after nonempty nodes with differing styles, but before inline nodes.

View File

@ -273,7 +273,7 @@ export const createEditor = (): Editor => {
voids: true,
})
n--
} else if (isLast && child.text === '') {
} else if (child.text === '') {
Transforms.removeNodes(editor, {
at: path.concat(n),
voids: true,

View File

@ -0,0 +1,22 @@
/** @jsx jsx */
import { jsx } from '../..'
export const input = (
<editor>
<block>
<text>not empty</text>
<text a />
<inline>inline</inline>
<text />
</block>
</editor>
)
export const output = (
<editor>
<block>
<text>not empty</text>
<inline>inline</inline>
<text />
</block>
</editor>
)