mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 09:43:58 +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:
5
.changeset/seven-fishes-check.md
Normal file
5
.changeset/seven-fishes-check.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Normalization now removes empty text nodes after nonempty nodes with differing styles, but before inline nodes.
|
@@ -273,7 +273,7 @@ export const createEditor = (): Editor => {
|
|||||||
voids: true,
|
voids: true,
|
||||||
})
|
})
|
||||||
n--
|
n--
|
||||||
} else if (isLast && child.text === '') {
|
} else if (child.text === '') {
|
||||||
Transforms.removeNodes(editor, {
|
Transforms.removeNodes(editor, {
|
||||||
at: path.concat(n),
|
at: path.concat(n),
|
||||||
voids: true,
|
voids: true,
|
||||||
|
@@ -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>
|
||||||
|
)
|
Reference in New Issue
Block a user