1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

fix for insertBlockAtRange in empty blocks, closes #224

This commit is contained in:
Ian Storm Taylor
2016-08-05 10:25:52 -07:00
parent 045fe02d5e
commit 90abc993b9
5 changed files with 22 additions and 1 deletions

View File

@@ -255,7 +255,8 @@ const Transforms = {
// If the block is empty, replace it.
else if (startBlock.isEmpty) {
parent = parent.merge({ nodes })
parent = parent.insertChildrenAfter(startBlock, nodes)
parent = parent.removeDescendant(startBlock)
}
// If the range is at the start of the block, insert before.

View File

@@ -5,3 +5,8 @@ nodes:
nodes:
- kind: text
text: ""
- kind: block
type: paragraph
nodes:
- kind: text
text: not empty

View File

@@ -5,3 +5,8 @@ nodes:
nodes:
- kind: text
text: ""
- kind: block
type: paragraph
nodes:
- kind: text
text: not empty

View File

@@ -5,3 +5,8 @@ nodes:
nodes:
- kind: text
text: ""
- kind: block
type: paragraph
nodes:
- kind: text
text: not empty

View File

@@ -5,3 +5,8 @@ nodes:
nodes:
- kind: text
text: ""
- kind: block
type: paragraph
nodes:
- kind: text
text: not empty