Use key binding for cancelling a message reply

pull/21833/head
Clemens Zeidler 2021-02-16 19:12:18 +13:00
parent ac7963b509
commit c84ad9bedc
2 changed files with 8 additions and 8 deletions

View File

@ -22,7 +22,7 @@ export enum KeyAction {
/** Start editing the user's next sent message */
EditNextMessage = 'EditNextMessage',
/** Cancel editing a message */
/** Cancel editing a message or cancel replying to a message */
CancelEditing = 'CancelEditing',
}

View File

@ -38,7 +38,6 @@ import * as sdk from '../../../index';
import Modal from '../../../Modal';
import {_t, _td} from '../../../languageHandler';
import ContentMessages from '../../../ContentMessages';
import {Key} from "../../../Keyboard";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import RateLimitedFunc from '../../../ratelimitedfunc';
import {Action} from "../../../dispatcher/actions";
@ -174,13 +173,14 @@ export default class SendMessageComposer extends React.Component {
}
}
break;
default:
if (event.key === Key.ESCAPE) {
case KeyAction.CancelEditing:
dis.dispatch({
action: 'reply_to_event',
event: null,
});
} else if (this._prepareToEncrypt) {
break;
default:
if (this._prepareToEncrypt) {
// This needs to be last!
this._prepareToEncrypt();
}