0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added ESC handling to modal-post-history

no issue

- added esc key handling
This commit is contained in:
Ronald 2023-04-21 16:24:20 +01:00
parent 960faf7d93
commit 47a327a4ba

View file

@ -74,6 +74,20 @@ export default class ModalPostHistory extends Component {
@action
onInsert() {
this.updateDiff();
window.addEventListener('keydown', this.handleKeyDown);
}
@action
willDestroy() {
super.willDestroy(...arguments);
window.removeEventListener('keydown', this.handleKeyDown);
}
@action
handleKeyDown(event) {
if (event.key === 'Escape') {
this.args.closeModal();
}
}
@action