Skip to content

Commit

Permalink
Update add in Keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Feb 18, 2019
1 parent efc6387 commit 4c65650
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/keymaps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = () => {

for (let id in defKeys) {
const value = defKeys[id];
this.add(id, value.keys, value.handler, { force: false });
this.add(id, value.keys, value.handler);
}
},

Expand All @@ -136,8 +136,7 @@ module.exports = () => {
* })
*/
add(id, keys, handler, opts = {}) {
const em = this.em;
const force = opts.force || false;
const { em } = this;
const cmd = em.get('Commands');
const editor = em.getEditor();
const canvas = em.get('Canvas');
Expand All @@ -151,7 +150,7 @@ module.exports = () => {
handler = isString(handler) ? cmd.get(handler) : handler;
opts.prevent && canvas.getCanvasView().preventDefault(e);
const ableTorun = !em.isEditing() && !editor.Canvas.isInputFocused();
if (ableTorun || force) {
if (ableTorun || opts.force) {
typeof handler == 'object'
? handler.run(editor, 0, opt)
: handler(editor, 0, opt);
Expand Down

0 comments on commit 4c65650

Please sign in to comment.