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:
parent
960faf7d93
commit
47a327a4ba
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue