diff options
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/element-mediator.js | 6 | ||||
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 16 |
2 files changed, 5 insertions, 17 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 9c9518a0..4a4c9f88 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -49,7 +49,7 @@ exports.ElementMediator = Montage.create(Component, { | |||
49 | }, | 49 | }, |
50 | 50 | ||
51 | addElements:{ | 51 | addElements:{ |
52 | value:function (elements, rules, notify) { | 52 | value:function (elements, rules, notify, callAddDelegate) { |
53 | if (Array.isArray(elements)) { | 53 | if (Array.isArray(elements)) { |
54 | elements.forEach(function (element) { | 54 | elements.forEach(function (element) { |
55 | ElementController.addElement(element, rules); | 55 | ElementController.addElement(element, rules); |
@@ -61,7 +61,9 @@ exports.ElementMediator = Montage.create(Component, { | |||
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
64 | if (this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { | 64 | if ((callAddDelegate || (typeof callAddDelegate === "undefined")) |
65 | && this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { | ||
66 | |||
65 | this.addDelegate['onAddElements'].call(this.addDelegate, elements); | 67 | this.addDelegate['onAddElements'].call(this.addDelegate, elements); |
66 | } | 68 | } |
67 | 69 | ||
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 36bc86fd..a323b9c3 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -98,20 +98,6 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
98 | value: function() { | 98 | value: function() { |
99 | document.addEventListener("keydown", this, false); | 99 | document.addEventListener("keydown", this, false); |
100 | document.addEventListener("keyup", this, false); | 100 | document.addEventListener("keyup", this, false); |
101 | |||
102 | this.addPropertyChangeListener("appModel.livePreview", this.handleLivePreview, false); | ||
103 | } | ||
104 | }, | ||
105 | |||
106 | handleLivePreview: { | ||
107 | value: function() { | ||
108 | if(this.appModel.livePreview) { | ||
109 | document.removeEventListener("keydown", this, false); | ||
110 | document.removeEventListener("keyup", this, false); | ||
111 | } else { | ||
112 | document.addEventListener("keydown", this, false); | ||
113 | document.addEventListener("keyup", this, false); | ||
114 | } | ||
115 | } | 101 | } |
116 | }, | 102 | }, |
117 | 103 | ||
@@ -264,7 +250,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
264 | 250 | ||
265 | 251 | ||
266 | if((evt.keyCode == Keyboard.ENTER) && (evt.ctrlKey || evt.metaKey)) { | 252 | if((evt.keyCode == Keyboard.ENTER) && (evt.ctrlKey || evt.metaKey)) { |
267 | this.application.ninja.executeChromePreview(); | 253 | this.application.ninja.handleExecutePreview(); |
268 | return; | 254 | return; |
269 | } | 255 | } |
270 | 256 | ||