Merge pull request #3842 from matrix-org/t3chguy/fix_isModified

Fix timing of when Composer considers itself to be modified
pull/21833/head
Travis Ralston 2020-01-16 09:54:36 -07:00 committed by GitHub
commit 64c4677699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -126,6 +126,7 @@ export default class BasicMessageEditor extends React.Component {
}
_updateEditorState = (selection, inputType, diff) => {
this._modifiedFlag = true;
renderModel(this._editorRef, this.props.model);
if (selection) { // set the caret/selection
try {
@ -237,7 +238,6 @@ export default class BasicMessageEditor extends React.Component {
const text = event.clipboardData.getData("text/plain");
parts = parsePlainTextMessage(text, partCreator);
}
this._modifiedFlag = true;
const range = getRangeForSelection(this._editorRef, model, document.getSelection());
replaceRangeAndMoveCaret(range, parts);
event.preventDefault();
@ -248,7 +248,6 @@ export default class BasicMessageEditor extends React.Component {
if (this._isIMEComposing) {
return;
}
this._modifiedFlag = true;
const sel = document.getSelection();
const {caret, text} = getCaretOffsetAndText(this._editorRef, sel);
this.props.model.update(text, event.inputType, caret);
@ -260,7 +259,6 @@ export default class BasicMessageEditor extends React.Component {
const newText = text.substr(0, caret.offset) + textToInsert + text.substr(caret.offset);
caret.offset += textToInsert.length;
this.props.model.update(newText, inputType, caret);
this._modifiedFlag = true;
}
// this is used later to see if we need to recalculate the caret