mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-25 16:20:49 +02:00
Wrap insertTextAtRange in withoutNormalizing (#2728)
This commit is contained in:
committed by
Ian Storm Taylor
parent
b448a19b8c
commit
7216fdc1bb
@@ -884,19 +884,21 @@ Commands.insertInlineAtRange = (editor, range, inline) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Commands.insertTextAtRange = (editor, range, text, marks) => {
|
Commands.insertTextAtRange = (editor, range, text, marks) => {
|
||||||
range = deleteExpandedAtRange(editor, range)
|
editor.withoutNormalizing(() => {
|
||||||
|
range = deleteExpandedAtRange(editor, range)
|
||||||
|
|
||||||
const { value } = editor
|
const { value } = editor
|
||||||
const { document } = value
|
const { document } = value
|
||||||
const { start } = range
|
const { start } = range
|
||||||
const offset = start.offset
|
const offset = start.offset
|
||||||
const parent = document.getParent(start.key)
|
const parent = document.getParent(start.key)
|
||||||
|
|
||||||
if (editor.isVoid(parent)) {
|
if (editor.isVoid(parent)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.insertTextByKey(start.key, offset, text, marks)
|
editor.insertTextByKey(start.key, offset, text, marks)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user