mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
fix normalization for inserting inlines and blocks
This commit is contained in:
@@ -258,6 +258,7 @@ export function insertBlockAtRange(transform, range, block) {
|
|||||||
transform.insertNodeByKey(parent.key, index + 1, block)
|
transform.insertNodeByKey(parent.key, index + 1, block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transform.normalizeDocument()
|
||||||
return transform
|
return transform
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,6 +375,7 @@ export function insertInlineAtRange(transform, range, inline) {
|
|||||||
|
|
||||||
transform.splitNodeByKey(startKey, startOffset)
|
transform.splitNodeByKey(startKey, startOffset)
|
||||||
transform.insertNodeByKey(parent.key, index + 1, inline)
|
transform.insertNodeByKey(parent.key, index + 1, inline)
|
||||||
|
transform.normalizeDocument()
|
||||||
return transform
|
return transform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,6 @@ nodes:
|
|||||||
nodes:
|
nodes:
|
||||||
- kind: text
|
- kind: text
|
||||||
text: rd
|
text: rd
|
||||||
- kind: inline
|
|
||||||
type: hashtag
|
|
||||||
nodes:
|
|
||||||
- kind: inline
|
- kind: inline
|
||||||
type: link
|
type: link
|
||||||
nodes:
|
nodes:
|
||||||
|
Reference in New Issue
Block a user