mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-25 00:11:43 +02:00
prevent inserting parts at index -1 for empty documents
This commit is contained in:
parent
06fb892df9
commit
dedf978948
@ -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…
x
Reference in New Issue
Block a user