set caret on mount as we usually do, so FF doesn't enter 2 newlines 🤯

This commit is contained in:
Bruno Windels 2019-05-16 18:39:20 +01:00
parent 98e033a529
commit 245f48a22c
2 changed files with 11 additions and 6 deletions

View file

@ -61,6 +61,16 @@ export default class EditorModel {
return null;
}
getPositionAtEnd() {
if (this._parts.length) {
const index = this._parts.length - 1;
const part = this._parts[index];
return new DocumentPosition(index, part.text.length);
} else {
return new DocumentPosition(0, 0);
}
}
serializeParts() {
return this._parts.map(({type, text}) => {return {type, text};});
}