aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-04-30 13:47:23 -0700
committerEric Guzman2012-04-30 13:47:23 -0700
commit76e4821c207736f9f0d88de91246e2cf08f5f6c0 (patch)
tree450b26fcc5963d6c0c6c293e5823ba0fd96756f5
parentaea46a37ae8038da570fc7cf07ef6e8c0d9ef577 (diff)
downloadninja-76e4821c207736f9f0d88de91246e2cf08f5f6c0.tar.gz
Editable - Add paste event handling/dispatching
-rw-r--r--js/components/editable.reel/editable.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js
index 1ebe33f1..f2cf0e5d 100644
--- a/js/components/editable.reel/editable.js
+++ b/js/components/editable.reel/editable.js
@@ -39,7 +39,9 @@ exports.Editable = Montage.create(Component, {
39 this._element = el; 39 this._element = el;
40 this._element.addEventListener('keydown', this, false); 40 this._element.addEventListener('keydown', this, false);
41 this._element.addEventListener('input', this, false); 41 this._element.addEventListener('input', this, false);
42 42 this._element.addEventListener('paste', this, false);
43
44
43 if(this.startOnEvent) { 45 if(this.startOnEvent) {
44 this._element.addEventListener(this.startOnEvent, this, false); 46 this._element.addEventListener(this.startOnEvent, this, false);
45 } 47 }
@@ -136,7 +138,9 @@ exports.Editable = Montage.create(Component, {
136 this._element.classList.remove(this.editingClass); 138 this._element.classList.remove(this.editingClass);
137 139
138 this._sendEvent('stop', eventData); 140 this._sendEvent('stop', eventData);
139 141
142 document.removeEventListener('mousedown', this, false);
143
140 ///// if value is different than pre-edit val, call onchange method 144 ///// if value is different than pre-edit val, call onchange method
141 if(this._preEditValue !== this.value) { 145 if(this._preEditValue !== this.value) {
142 this._sendEvent('change'); 146 this._sendEvent('change');
@@ -179,7 +183,6 @@ exports.Editable = Montage.create(Component, {
179 this.accept(); 183 this.accept();
180 } 184 }
181 this.stop(eventData); 185 this.stop(eventData);
182 document.removeEventListener('mousedown', this, false);
183 this._sendEvent('blur'); 186 this._sendEvent('blur');
184 } 187 }
185 }, 188 },
@@ -214,6 +217,11 @@ exports.Editable = Montage.create(Component, {
214 } 217 }
215 } 218 }
216 }, 219 },
220 handlePaste : {
221 value: function(e) {
222 this._sendEvent('paste', e);
223 }
224 },
217 handleEvent : { 225 handleEvent : {
218 value : function(e) { 226 value : function(e) {
219 console.log("event type : " + e._event.type); 227 console.log("event type : " + e._event.type);