initial parsing of pills for editor

This commit is contained in:
Bruno Windels 2019-05-07 17:31:37 +02:00
parent 76bb56a2bf
commit 6be6492cd2
2 changed files with 59 additions and 4 deletions

View file

@ -19,8 +19,8 @@ import {_t} from '../../../languageHandler';
import PropTypes from 'prop-types';
import dis from '../../../dispatcher';
import EditorModel from '../../../editor/model';
import {PlainPart} from '../../../editor/parts';
import {getCaretOffset, setCaretPosition} from '../../../editor/caret';
import parseEvent from '../../../editor/parse-event';
import {MatrixEvent, MatrixClient} from 'matrix-js-sdk';
export default class MessageEditor extends React.Component {
@ -37,9 +37,7 @@ export default class MessageEditor extends React.Component {
constructor(props, context) {
super(props, context);
const body = this.props.event.getContent().body;
this.model = new EditorModel();
this.model.update(body, undefined, {offset: body.length});
this.model = new EditorModel(parseEvent(this.props.event));
this.state = {
parts: this.model.serializeParts(),
};