mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #6365 from acburdine/remove-on
remove more usage of Ember.on
This commit is contained in:
commit
8ddf160240
1 changed files with 15 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
/* global key */
|
/* global key */
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
const {Component, on, run} = Ember;
|
const {Component, run} = Ember;
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
tagName: 'section',
|
tagName: 'section',
|
||||||
|
@ -9,7 +9,7 @@ export default Component.extend({
|
||||||
|
|
||||||
_previousKeymasterScope: null,
|
_previousKeymasterScope: null,
|
||||||
|
|
||||||
setupShortcuts: on('didInsertElement', function () {
|
_setupShortcuts() {
|
||||||
run(function () {
|
run(function () {
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
});
|
});
|
||||||
|
@ -24,14 +24,24 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
key.setScope('modal');
|
key.setScope('modal');
|
||||||
}),
|
},
|
||||||
|
|
||||||
removeShortcuts: on('willDestroyElement', function () {
|
_removeShortcuts() {
|
||||||
key.unbind('enter', 'modal');
|
key.unbind('enter', 'modal');
|
||||||
key.unbind('escape', 'modal');
|
key.unbind('escape', 'modal');
|
||||||
|
|
||||||
key.setScope(this._previousKeymasterScope);
|
key.setScope(this._previousKeymasterScope);
|
||||||
}),
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this._setupShortcuts();
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this._removeShortcuts();
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
confirm() {
|
confirm() {
|
||||||
|
|
Loading…
Reference in a new issue