aboutsummaryrefslogtreecommitdiff
path: root/js/clipboard/internal-ops
diff options
context:
space:
mode:
authorAnanya Sen2012-07-16 15:34:07 -0700
committerAnanya Sen2012-07-16 15:34:07 -0700
commit5a34cac9594d710f6e5675bee34dc16be1b4d8a0 (patch)
tree1078009cd6443ac9cabfeb2cbdc5110b5e195b38 /js/clipboard/internal-ops
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
downloadninja-5a34cac9594d710f6e5675bee34dc16be1b4d8a0.tar.gz
Fixed copy paste from external applications
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/clipboard/internal-ops')
-rw-r--r--js/clipboard/internal-ops/elements-clipboard-agent.js24
1 files changed, 8 insertions, 16 deletions
diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js
index a6bce2ba..cfc75916 100644
--- a/js/clipboard/internal-ops/elements-clipboard-agent.js
+++ b/js/clipboard/internal-ops/elements-clipboard-agent.js
@@ -152,8 +152,6 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
152 152
153 this.pasteCounter++; 153 this.pasteCounter++;
154 154
155 //cleanse HTML
156
157 for(j=0; j< this.copiedObjects.copy.length; j++){ 155 for(j=0; j< this.copiedObjects.copy.length; j++){
158 copiedElement = this.copiedObjects.copy[j]; 156 copiedElement = this.copiedObjects.copy[j];
159 styles = null; 157 styles = null;
@@ -259,16 +257,13 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
259 257
260 if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){ 258 if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){
261 styles = canvas.elementModel.data || {}; 259 styles = canvas.elementModel.data || {};
262 styles.top = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "top", parseInt) + (25 * this.pasteCounter))+"px"; 260 styles.top = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "top", parseInt) + (10 * this.pasteCounter))+"px";
263 styles.left = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "left", parseInt) + (25 * this.pasteCounter)) + "px"; 261 styles.left = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "left", parseInt) + (10 * this.pasteCounter)) + "px";
264 }else{ 262 }else{
265 styles = null; 263 styles = null;
266 } 264 }
267 265
268 var addDelegate = this.application.ninja.elementMediator.addDelegate; 266 this.application.ninja.elementMediator.addElements(canvas, styles, false/*notify*/, false /*callAddDelegate*/);
269 this.application.ninja.elementMediator.addDelegate = null;
270 this.application.ninja.elementMediator.addElements(canvas, styles, false);
271 this.application.ninja.elementMediator.addDelegate = addDelegate;
272 267
273 worldData = sourceCanvas.elementModel.shapeModel ? sourceCanvas.elementModel.shapeModel.GLWorld.exportJSON(): null; 268 worldData = sourceCanvas.elementModel.shapeModel ? sourceCanvas.elementModel.shapeModel.GLWorld.exportJSON(): null;
274 if(worldData) 269 if(worldData)
@@ -360,13 +355,11 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
360 355
361 x = styles ? ("" + styles.left + "px") : "100px"; 356 x = styles ? ("" + styles.left + "px") : "100px";
362 y = styles ? ("" + styles.top + "px") : "100px"; 357 y = styles ? ("" + styles.top + "px") : "100px";
363 newX = styles ? ("" + (styles.left + (25 * counter)) + "px") : "100px"; 358 newX = styles ? ("" + (styles.left + (10 * counter)) + "px") : "100px";
364 newY = styles ? ("" + (styles.top + (25 * counter)) + "px") : "100px"; 359 newY = styles ? ("" + (styles.top + (10 * counter)) + "px") : "100px";
365 360
366 var addDelegate = this.application.ninja.elementMediator.addDelegate;
367 this.application.ninja.elementMediator.addDelegate = null;
368 if(!styles || (styles && !styles.position)){ 361 if(!styles || (styles && !styles.position)){
369 this.application.ninja.elementMediator.addElements(element, null, false); 362 this.application.ninja.elementMediator.addElements(element, null, false /*notify*/, false /*callAddDelegate*/);
370 }else if(styles && (styles.position === "absolute")){ 363 }else if(styles && (styles.position === "absolute")){
371 if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){ 364 if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){
372 element.onload = function(){ 365 element.onload = function(){
@@ -376,9 +369,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
376 } 369 }
377 } 370 }
378 371
379 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace 372 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false/*notify*/, false /*callAddDelegate*/);//displace
380 } 373 }
381 this.application.ninja.elementMediator.addDelegate = addDelegate;
382 } 374 }
383 }, 375 },
384 376