prevent inserting parts at index -1 for empty documents
parent
06fb892df9
commit
dedf978948
|
@ -244,6 +244,10 @@ export default class EditorModel {
|
||||||
addLen += part.text.length - offset;
|
addLen += part.text.length - offset;
|
||||||
index += 1;
|
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) {
|
while (str) {
|
||||||
const newPart = this._partCreator.createPartForInput(str);
|
const newPart = this._partCreator.createPartForInput(str);
|
||||||
|
|
Loading…
Reference in New Issue