From 1523d304f29b177d222ff41e15ce16b569fd2a1b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Jun 2017 10:30:59 +0100 Subject: [PATCH] WIP to prevent RTE from deleting current message input when up arrow pressed --- src/components/views/rooms/MessageComposerInput.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index b05beb2571..7603a45e4c 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -560,7 +560,7 @@ export default class MessageComposerInput extends React.Component { onUpArrow = async (e) => { const completion = this.autocomplete.onUpArrow(); - if (completion == null) { + if (completion == null && !(this.historyManager.currentIndex === -1 && this.state.editorState.getCurrentContent().hasText())) { const newContent = this.historyManager.getItem(-1, this.state.isRichtextEnabled ? 'html' : 'markdown'); if (!newContent) return false; const editorState = EditorState.push(this.state.editorState, @@ -575,7 +575,7 @@ export default class MessageComposerInput extends React.Component { onDownArrow = async (e) => { const completion = this.autocomplete.onDownArrow(); - if (completion == null) { + if (completion == null && !(this.historyManager.currentIndex === -1 && this.state.editorState.getCurrentContent().hasText())) { const newContent = this.historyManager.getItem(+1, this.state.isRichtextEnabled ? 'html' : 'markdown'); if (!newContent) return false; const editorState = EditorState.push(this.state.editorState,