prevent inserting parts at index -1 for empty documents
This commit is contained in:
parent
06fb892df9
commit
dedf978948
1 changed files with 4 additions and 0 deletions
|
@ -244,6 +244,10 @@ export default class EditorModel {
|
|||
addLen += part.text.length - offset;
|
||||
index += 1;
|
||||
}
|
||||
} else if (index < 0) {
|
||||
// if position was not found (index: -1, as happens for empty editor)
|
||||
// reset it to insert as first part
|
||||
index = 0;
|
||||
}
|
||||
while (str) {
|
||||
const newPart = this._partCreator.createPartForInput(str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue