From 585c4468c1e6f671f3bd2f790aef0099a461dd02 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Thu, 13 Apr 2017 10:57:57 +0100 Subject: [PATCH] bug fix for double key-binding --- app/app/components/section/base-editor-inline.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/app/components/section/base-editor-inline.js b/app/app/components/section/base-editor-inline.js index e8941f5d..62840501 100644 --- a/app/app/components/section/base-editor-inline.js +++ b/app/app/components/section/base-editor-inline.js @@ -48,7 +48,11 @@ export default Ember.Component.extend({ didRender() { let msContainer = document.getElementById(this.get('containerId')); - let mousetrap = new Mousetrap(msContainer); + let mousetrap = this.get('mousetrap'); + + if (is.null(mousetrap)) { + mousetrap = new Mousetrap(msContainer); + } mousetrap.bind('esc', () => { this.send('onCancel'); @@ -68,7 +72,6 @@ export default Ember.Component.extend({ willDestroyElement() { let drop = this.get('drop'); - if (is.not.null(drop)) { drop.destroy(); }