mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
e10c0f20cf
Closes #2988, #2752 Ref #1463, #2984, # Shortcuts via Keymaster - Added KeyMaster to bower dependencies. KeyMaster is a minimal keyboard shortcuts library. - Added `ShortcutsRouteMixin` for routes that will use shortcuts. Currently, only routes can have shortcuts. See the extensive comment at the top of `core/client/mixins/shortcuts-route.js` for a description of how to implement shortcuts. ## Other Changes - Injected popover service into ApplicationRoute - Created `EditorRouteBase` mixin for the `editor.new` and `editor.edit` routes to mixin. - `StyleBodyMixin` now calls `this._super()` on `activate` and `deactivate` to play nicely with other mixins. ## Shortcuts and Stubs implemented #### Application-Wide - `'esc':'closePopups'` shortcut **stub** to close popovers, modals, and notifcations #### Editor Shortcuts - `'ctrl+s, command+s': 'save'` note that `command` is the `meta` key. - `'ctrl+alt+p': 'publish'` - `'ctrl+alt+z': 'toggleZenMode'`
30 lines
982 B
JavaScript
30 lines
982 B
JavaScript
import BodyEventListener from 'ghost/mixins/body-event-listener';
|
|
|
|
var PopoverService = Ember.Object.extend(Ember.Evented, BodyEventListener, {
|
|
bodyClick: function (event) {
|
|
/*jshint unused:false */
|
|
this.closePopovers();
|
|
},
|
|
closePopovers: function () {
|
|
this.trigger('close');
|
|
},
|
|
togglePopover: function (popoverName) {
|
|
this.trigger('toggle', {target: popoverName});
|
|
}
|
|
});
|
|
|
|
var popoverInitializer = {
|
|
name: 'popover',
|
|
|
|
initialize: function (container, application) {
|
|
application.register('popover:service', PopoverService);
|
|
|
|
application.inject('component:gh-popover', 'popover', 'popover:service');
|
|
application.inject('component:gh-popover-button', 'popover', 'popover:service');
|
|
application.inject('controller:modals.delete-post', 'popover', 'popover:service');
|
|
application.inject('route:application', 'popover', 'popover:service');
|
|
}
|
|
};
|
|
|
|
export default popoverInitializer;
|