mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 15:02:51 +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) => {
|
||||
range = deleteExpandedAtRange(editor, range)
|
||||
editor.withoutNormalizing(() => {
|
||||
range = deleteExpandedAtRange(editor, range)
|
||||
|
||||
const { value } = editor
|
||||
const { document } = value
|
||||
const { start } = range
|
||||
const offset = start.offset
|
||||
const parent = document.getParent(start.key)
|
||||
const { value } = editor
|
||||
const { document } = value
|
||||
const { start } = range
|
||||
const offset = start.offset
|
||||
const parent = document.getParent(start.key)
|
||||
|
||||
if (editor.isVoid(parent)) {
|
||||
return
|
||||
}
|
||||
if (editor.isVoid(parent)) {
|
||||
return
|
||||
}
|
||||
|
||||
editor.insertTextByKey(start.key, offset, text, marks)
|
||||
editor.insertTextByKey(start.key, offset, text, marks)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user