diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index 9ada9df720..a488990210 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -136,6 +136,10 @@ export default class BasicMessageEditor extends React.Component { return this._lastCaret; } + clearUndoHistory() { + this.historyManager.clear(); + } + getCaret() { return this._lastCaret; } diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js index 4c6d763411..3b65b3e83d 100644 --- a/src/components/views/rooms/SendMessageComposer.js +++ b/src/components/views/rooms/SendMessageComposer.js @@ -100,6 +100,8 @@ export default class SendMessageComposer extends React.Component { const {roomId} = this.props.room; this.context.matrixClient.sendMessage(roomId, createMessageContent(this.model, this.props.permalinkCreator)); this.model.reset([]); + this._editorRef.clearUndoHistory(); + if (isReply) { // Clear reply_to_event as we put the message into the queue // if the send fails, retry will handle resending. diff --git a/src/editor/history.js b/src/editor/history.js index 6fd67d067c..de052cf682 100644 --- a/src/editor/history.js +++ b/src/editor/history.js @@ -18,6 +18,10 @@ export const MAX_STEP_LENGTH = 10; export default class HistoryManager { constructor() { + this.clear(); + } + + clear() { this._stack = []; this._newlyTypedCharCount = 0; this._currentIndex = -1;