diff options
-rw-r--r-- | js/components/editable.reel/editable.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js index ef4096fd..1ebe33f1 100644 --- a/js/components/editable.reel/editable.js +++ b/js/components/editable.reel/editable.js | |||
@@ -131,11 +131,11 @@ exports.Editable = Montage.create(Component, { | |||
131 | } | 131 | } |
132 | }, | 132 | }, |
133 | stop : { | 133 | stop : { |
134 | value: function() { | 134 | value: function(eventData) { |
135 | this._isEditable = this._element.contentEditable = false; | 135 | this._isEditable = this._element.contentEditable = false; |
136 | this._element.classList.remove(this.editingClass); | 136 | this._element.classList.remove(this.editingClass); |
137 | 137 | ||
138 | this._sendEvent('stop'); | 138 | this._sendEvent('stop', eventData); |
139 | 139 | ||
140 | ///// if value is different than pre-edit val, call onchange method | 140 | ///// if value is different than pre-edit val, call onchange method |
141 | if(this._preEditValue !== this.value) { | 141 | if(this._preEditValue !== this.value) { |
@@ -174,11 +174,11 @@ exports.Editable = Montage.create(Component, { | |||
174 | } | 174 | } |
175 | }, | 175 | }, |
176 | blur : { | 176 | blur : { |
177 | value : function() { | 177 | value : function(eventData) { |
178 | if(this._hint) { | 178 | if(this._hint) { |
179 | this.accept(); | 179 | this.accept(); |
180 | } | 180 | } |
181 | this.stop(); | 181 | this.stop(eventData); |
182 | document.removeEventListener('mousedown', this, false); | 182 | document.removeEventListener('mousedown', this, false); |
183 | this._sendEvent('blur'); | 183 | this._sendEvent('blur'); |
184 | } | 184 | } |
@@ -207,7 +207,10 @@ exports.Editable = Montage.create(Component, { | |||
207 | console.log('handle mouse down'); | 207 | console.log('handle mouse down'); |
208 | ///// Listen for simulated blur event | 208 | ///// Listen for simulated blur event |
209 | if(this.stopOnBlur && e._event.target !== this._element) { | 209 | if(this.stopOnBlur && e._event.target !== this._element) { |
210 | this.blur(); | 210 | this.blur({ |
211 | "originalEventType": "mousedown", | ||
212 | "originalEvent": e | ||
213 | }); | ||
211 | } | 214 | } |
212 | } | 215 | } |
213 | }, | 216 | }, |
@@ -221,9 +224,9 @@ exports.Editable = Montage.create(Component, { | |||
221 | } | 224 | } |
222 | }, | 225 | }, |
223 | _sendEvent : { | 226 | _sendEvent : { |
224 | value : function(type) { | 227 | value : function(type, data) { |
225 | var evt = document.createEvent("CustomEvent"); | 228 | var evt = document.createEvent("CustomEvent"); |
226 | evt.initCustomEvent(type, true, true); | 229 | evt.initCustomEvent(type, true, true, data); |
227 | this.dispatchEvent(evt); | 230 | this.dispatchEvent(evt); |
228 | } | 231 | } |
229 | }, | 232 | }, |