From 4eb6942211e613a11c999d1c44f38691d47fd49a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 15 May 2018 01:16:06 +0100 Subject: [PATCH] let onChange set originalEditorState --- src/components/views/rooms/MessageComposerInput.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 204ad524fe..39d49ecf83 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -346,7 +346,7 @@ export default class MessageComposerInput extends React.Component { } } - onChange = (change: Change) => { + onChange = (change: Change, originalEditorState: value) => { let editorState = change.value; @@ -467,7 +467,7 @@ export default class MessageComposerInput extends React.Component { /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, - originalEditorState: null, + originalEditorState: originalEditorState || null }); }; @@ -1050,11 +1050,7 @@ export default class MessageComposerInput extends React.Component { } editorState = change.value; - this.onChange(change); - - this.setState({ - originalEditorState: activeEditorState - }); + this.onChange(change, activeEditorState); return true; };