mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-19 05:21:22 +02:00
clear composer undo history when sending a message
This commit is contained in:
parent
0adca10f9f
commit
9bc8ff7e1e
@ -136,6 +136,10 @@ export default class BasicMessageEditor extends React.Component {
|
|||||||
return this._lastCaret;
|
return this._lastCaret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearUndoHistory() {
|
||||||
|
this.historyManager.clear();
|
||||||
|
}
|
||||||
|
|
||||||
getCaret() {
|
getCaret() {
|
||||||
return this._lastCaret;
|
return this._lastCaret;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ export default class SendMessageComposer extends React.Component {
|
|||||||
const {roomId} = this.props.room;
|
const {roomId} = this.props.room;
|
||||||
this.context.matrixClient.sendMessage(roomId, createMessageContent(this.model, this.props.permalinkCreator));
|
this.context.matrixClient.sendMessage(roomId, createMessageContent(this.model, this.props.permalinkCreator));
|
||||||
this.model.reset([]);
|
this.model.reset([]);
|
||||||
|
this._editorRef.clearUndoHistory();
|
||||||
|
|
||||||
if (isReply) {
|
if (isReply) {
|
||||||
// Clear reply_to_event as we put the message into the queue
|
// Clear reply_to_event as we put the message into the queue
|
||||||
// if the send fails, retry will handle resending.
|
// if the send fails, retry will handle resending.
|
||||||
|
@ -18,6 +18,10 @@ export const MAX_STEP_LENGTH = 10;
|
|||||||
|
|
||||||
export default class HistoryManager {
|
export default class HistoryManager {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
clear() {
|
||||||
this._stack = [];
|
this._stack = [];
|
||||||
this._newlyTypedCharCount = 0;
|
this._newlyTypedCharCount = 0;
|
||||||
this._currentIndex = -1;
|
this._currentIndex = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user