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:
parent
ace397f966
commit
95c759a19c
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,
|
||||
})
|
||||
n--
|
||||
} else if (isLast && child.text === '') {
|
||||
} else if (child.text === '') {
|
||||
Transforms.removeNodes(editor, {
|
||||
at: path.concat(n),
|
||||
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>
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user