mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Fixed preview shortcut not working when billing app is enabled
no issue - the billing modal is always rendered, it's contents being shown/hidden via CSS - when the billing modal was rendered it was changing the `key` scope and binding the enter key, however because it's always rendered this was messing with the default key scope for all other areas of the app - removed all keyboard handling from the billing modal because it wasn't actually doing anything (there is nothing to handle the "confirm" action when Enter is pressed) which fixes the unexpected key scope change
This commit is contained in:
parent
d3b3a0117d
commit
cce71e5517
@ -1,42 +1,11 @@
|
||||
/* global key */
|
||||
import Component from '@ember/component';
|
||||
import {computed} from '@ember/object';
|
||||
import {run} from '@ember/runloop';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Component.extend({
|
||||
billing: service(),
|
||||
|
||||
visibilityClass: computed('billing.billingWindowOpen', function () {
|
||||
return this.billing.get('billingWindowOpen') ? 'gh-billing' : 'gh-billing closed';
|
||||
}),
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
this._setupShortcuts();
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
this._removeShortcuts();
|
||||
},
|
||||
|
||||
_setupShortcuts() {
|
||||
run(function () {
|
||||
document.activeElement.blur();
|
||||
});
|
||||
|
||||
this._previousKeymasterScope = key.getScope();
|
||||
|
||||
key('enter', 'modal', () => {
|
||||
this.send('confirm');
|
||||
});
|
||||
|
||||
key.setScope('modal');
|
||||
},
|
||||
|
||||
_removeShortcuts() {
|
||||
key.unbind('enter', 'modal');
|
||||
key.setScope(this._previousKeymasterScope);
|
||||
}
|
||||
visibilityClass: computed('billingWindowOpen', function () {
|
||||
return this.billingWindowOpen ? 'gh-billing' : 'gh-billing closed';
|
||||
})
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ import {computed} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Controller.extend({
|
||||
billing: service(),
|
||||
customViews: service(),
|
||||
config: service(),
|
||||
dropdown: service(),
|
||||
|
@ -12,7 +12,7 @@
|
||||
{{outlet}}
|
||||
|
||||
{{#if this.showBilling}}
|
||||
<GhBillingModal />
|
||||
<GhBillingModal @billingWindowOpen={{this.billing.billingWindowOpen}} />
|
||||
{{/if}}
|
||||
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user