From f2dbca782bbaca3bed96dff808693693ba083ea9 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 17 Jul 2012 14:24:17 -0700 Subject: Fixes : resize wrapper for content, prevent duplicate pastes Signed-off-by: Ananya Sen --- js/clipboard/external-apps-clipboard-agent.js | 58 ++++++++++++++++++--------- 1 file changed, 38 insertions(+), 20 deletions(-) (limited to 'js/clipboard') diff --git a/js/clipboard/external-apps-clipboard-agent.js b/js/clipboard/external-apps-clipboard-agent.js index e78950df..819f515e 100644 --- a/js/clipboard/external-apps-clipboard-agent.js +++ b/js/clipboard/external-apps-clipboard-agent.js @@ -52,8 +52,13 @@ var ExternalAppsClipboardAgent = exports.ExternalAppsClipboardAgent = Montage.cr i=0, imageMime, imageData, imageElement; - //handle image blobs - if(clipboardData.items && (clipboardData.items.length > 0)){ + if(!!htmlData || !!textData){ + try{ + this.doPasteHtml(htmlData, textData); + }catch(e){ + console.log(""+e.stack); + } + }else if(clipboardData.items && (clipboardData.items.length > 0)){//handle image blobs for(i=0; i < clipboardData.items.length; i++ ){ if((clipboardData.items[i].kind === "file") && (clipboardData.items[i].type.indexOf("image") === 0)){//example type -> "image/png" imageMime = clipboardData.items[i].type; @@ -67,15 +72,6 @@ var ExternalAppsClipboardAgent = exports.ExternalAppsClipboardAgent = Montage.cr } } } - - try{ - if(!!htmlData || !!textData){ - this.doPasteHtml(htmlData, textData); - } - }catch(e){ - console.log(""+e.stack); - } - } }, @@ -134,14 +130,8 @@ var ExternalAppsClipboardAgent = exports.ExternalAppsClipboardAgent = Montage.cr value: function(htmlData, textData){ var divWrapper = null, data = null; - if(htmlData){ - //cleanse HTML - htmlData = htmlData.replace(/\]+>/gi, ""); // Remove the meta tag. - htmlData = htmlData.replace(/\