From bc73fb06503f2507da974bd8fd723f4eae99783f Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Tue, 19 Jan 2016 10:00:44 -0600 Subject: [PATCH] remove more usage of Ember.on --- ghost/admin/app/components/modals/base.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ghost/admin/app/components/modals/base.js b/ghost/admin/app/components/modals/base.js index 40951062be..1f8231facc 100644 --- a/ghost/admin/app/components/modals/base.js +++ b/ghost/admin/app/components/modals/base.js @@ -1,7 +1,7 @@ /* global key */ import Ember from 'ember'; -const {Component, on, run} = Ember; +const {Component, run} = Ember; export default Component.extend({ tagName: 'section', @@ -9,7 +9,7 @@ export default Component.extend({ _previousKeymasterScope: null, - setupShortcuts: on('didInsertElement', function () { + _setupShortcuts() { run(function () { document.activeElement.blur(); }); @@ -24,14 +24,24 @@ export default Component.extend({ }); key.setScope('modal'); - }), + }, - removeShortcuts: on('willDestroyElement', function () { + _removeShortcuts() { key.unbind('enter', 'modal'); key.unbind('escape', 'modal'); key.setScope(this._previousKeymasterScope); - }), + }, + + didInsertElement() { + this._super(...arguments); + this._setupShortcuts(); + }, + + willDestroyElement() { + this._super(...arguments); + this._removeShortcuts(); + }, actions: { confirm() {