Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4297 from matrix-org/t3chguy/kbd11
Browse files Browse the repository at this point in the history
Keyboard shortcuts: Escape cancel reply and fix Ctrl+K
  • Loading branch information
t3chguy authored Mar 30, 2020
2 parents 057ca35 + 167f953 commit 90b8d87
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/accessibility/KeyboardShortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ const shortcuts: Record<Categories, IShortcut[]> = {
key: Key.ARROW_DOWN,
}],
description: _td("Navigate composer history"),
}, {
keybinds: [{
key: Key.ESCAPE,
}],
description: _td("Cancel replying to a message"),
},
],

Expand Down
1 change: 1 addition & 0 deletions src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ export default createReactClass({
collapseLhs: true,
});
break;
case 'focus_room_filter': // for CtrlOrCmd+K to work by expanding the left panel first
case 'show_left_panel':
this.setState({
collapseLhs: false,
Expand Down
7 changes: 6 additions & 1 deletion src/components/views/rooms/SendMessageComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ export default class SendMessageComposer extends React.Component {
this.onVerticalArrow(event, false);
} else if (this._prepareToEncrypt) {
this._prepareToEncrypt();
} else if (event.key === Key.ESCAPE) {
dis.dispatch({
action: 'reply_to_event',
event: null,
});
}
}
};

onVerticalArrow(e, up) {
// arrows from an initial-caret composer navigates recent messages to edit
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2216,6 +2216,7 @@
"Navigate recent messages to edit": "Navigate recent messages to edit",
"Jump to start/end of the composer": "Jump to start/end of the composer",
"Navigate composer history": "Navigate composer history",
"Cancel replying to a message": "Cancel replying to a message",
"Toggle microphone mute": "Toggle microphone mute",
"Toggle video on/off": "Toggle video on/off",
"Jump to room search": "Jump to room search",
Expand Down

0 comments on commit 90b8d87

Please sign in to comment.