From e4d3e040e521648ec9a6d0e0db2e62754f2d8882 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 27 Jun 2012 17:41:52 -0700 Subject: fixed IKNINJA-1762 [Copy/Cut on canvas tag tool throws error on console] -> don't generate data-RDGE-id for simple canvas element Signed-off-by: Ananya Sen --- js/clipboard/internal-ops/elements-clipboard-agent.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index cd8de46e..1a4bfdba 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -232,7 +232,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com canvas.height = sourceCanvas.height; //end - clone copied canvas - if (!canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); + //genenerate data-RDGE-id only for shapes + if (sourceCanvas.elementModel.shapeModel && !canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){ styles = canvas.elementModel.data || {}; @@ -275,7 +276,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com canvas.width = styles.width; canvas.height = styles.height; - if (!canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); + //genenerate data-RDGE-id only for shapes + if (worldJson && !canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); this.pastePositioned(canvas, styles, false/*from copy*/); -- cgit v1.2.3