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:
@@ -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.
|
||||
|
@@ -5,3 +5,8 @@ nodes:
|
||||
nodes:
|
||||
- kind: text
|
||||
text: ""
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: not empty
|
||||
|
@@ -5,3 +5,8 @@ nodes:
|
||||
nodes:
|
||||
- kind: text
|
||||
text: ""
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: not empty
|
||||
|
@@ -5,3 +5,8 @@ nodes:
|
||||
nodes:
|
||||
- kind: text
|
||||
text: ""
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: not empty
|
||||
|
@@ -5,3 +5,8 @@ nodes:
|
||||
nodes:
|
||||
- kind: text
|
||||
text: ""
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: not empty
|
||||
|
Reference in New Issue
Block a user