Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

🐛 Fixed j and k keys not working in editor after visiting Tags screen #1002

Merged
merged 1 commit into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions app/mixins/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,27 @@ key.setScope('default');
*/
export default Mixin.create({

_hasRegisteredShortcuts: false,

registerShortcuts() {
if (!this._hasRegisteredShortcuts) {
let shortcuts = this.get('shortcuts');
let shortcuts = this.get('shortcuts');

Object.keys(shortcuts).forEach((shortcut) => {
let scope = shortcuts[shortcut].scope || 'default';
let action = shortcuts[shortcut];
let options;
Object.keys(shortcuts).forEach((shortcut) => {
let scope = shortcuts[shortcut].scope || 'default';
let action = shortcuts[shortcut];
let options;

if (typeOf(action) !== 'string') {
options = action.options;
action = action.action;
}
if (typeOf(action) !== 'string') {
options = action.options;
action = action.action;
}

key(shortcut, scope, (event) => {
// stop things like ctrl+s from actually opening a save dialogue
event.preventDefault();
run(this, function () {
this.send(action, options);
});
key(shortcut, scope, (event) => {
// stop things like ctrl+s from actually opening a save dialogue
event.preventDefault();
run(this, function () {
this.send(action, options);
});
});

this._hasRegisteredShortcuts = true;
}
});
},

removeShortcuts() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"google-caja-bower": "https://github.com/acburdine/google-caja-bower#ghost",
"grunt": "1.0.2",
"grunt-shell": "2.1.0",
"keymaster": "1.6.2",
"keymaster": "https://github.com/madrobby/keymaster.git",
"liquid-fire": "0.29.2",
"liquid-tether": "2.0.6",
"liquid-wormhole": "2.1.1",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6493,9 +6493,9 @@ just-extend@^1.1.27:
version "1.1.27"
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905"

keymaster@1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/keymaster/-/keymaster-1.6.2.tgz#e1ae54d0ea9488f9f60b66b668f02e9a1946c6eb"
"keymaster@https://github.com/madrobby/keymaster.git":
version "1.6.3"
resolved "https://github.com/madrobby/keymaster.git#3b1f2afabf1569848dea8b697ac418f19b601a30"

kind-of@^1.1.0:
version "1.1.0"
Expand Down