1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Editor must be focused before allowing certain keyboard shortcuts.

closes #4253
- checked for the CodeMirror-focused class on the CodeMirror div
- used length to determine whether CodeMirror-focused has been added
- determines whether the editor has been focused on
This commit is contained in:
David Robson 2014-11-01 16:54:24 +00:00
parent 0dc81c5324
commit ce579415f7

View file

@ -22,7 +22,10 @@ var EditorRouteBase = Ember.Mixin.create(styleBody, ShortcutsRoute, loadingIndic
// The actual functionality is implemented in utils/codemirror-shortcuts
codeMirrorShortcut: function (options) {
this.get('controller.codemirror').shortcut(options.type);
// Only fire editor shortcuts when the editor has focus.
if (Ember.$('.CodeMirror.CodeMirror-focused').length > 0) {
this.get('controller.codemirror').shortcut(options.type);
}
}
},