aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-05-08 12:13:55 -0700
committerAnanya Sen2012-05-08 12:13:55 -0700
commit8e7528f672900fb50bd624439261b4402e2fd883 (patch)
treee09efba7309b410498afb3e9b82966a52dc13b9a /js/controllers
parentf6e4436b024bddae92348fc975b5fd6c4595cb61 (diff)
downloadninja-8e7528f672900fb50bd624439261b4402e2fd883.tar.gz
removed unnecessary function
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/clipboard-controller.js52
1 files changed, 2 insertions, 50 deletions
diff --git a/js/controllers/clipboard-controller.js b/js/controllers/clipboard-controller.js
index b2e5a33b..d26aaa80 100644
--- a/js/controllers/clipboard-controller.js
+++ b/js/controllers/clipboard-controller.js
@@ -61,9 +61,9 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
61 value:function(clipboardEvent){ 61 value:function(clipboardEvent){
62 //depends on the clipboard event 62 //depends on the clipboard event
63 if(this.application.ninja.selectedElements.length > 0){ 63 if(this.application.ninja.selectedElements.length > 0){
64 clipboardEvent.clipboardData.setData('text/html', ''+this.application.ninja.selectedElements[0].outerHTML);//copying first selected element for POC 64 clipboardEvent.clipboardData.setData('text/html', ''+this.application.ninja.selectedElements[0].outerHTML);//copying first selected element for POC
65 65
66 clipboardEvent.preventDefault(); 66 clipboardEvent.preventDefault();
67 } 67 }
68 } 68 }
69 }, 69 },
@@ -78,7 +78,6 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
78 78
79 79
80 clipboardEvent.preventDefault(); 80 clipboardEvent.preventDefault();
81 clipboardEvent.stopPropagation();
82 } 81 }
83 }, 82 },
84 83
@@ -100,52 +99,5 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
100 99
101 clipboardEvent.preventDefault(); 100 clipboardEvent.preventDefault();
102 } 101 }
103 },
104
105 /*
106 does not preserve the css class / html structure while copying
107 */
108 copyUsingContenteditable:{
109 value:function(){
110 var clipboardHelper=document.getElementById("clipboardHelper"),copyElement = null, textData = "";
111 if((this.copyFlag === true) ) {
112 if(!clipboardHelper) clipboardHelper.innerHTML = "";//clear
113 this.copyFlag = false;
114 return;//break infinite loop
115 }
116
117 //dynamically create editable div for execCommand->copy
118 if(!clipboardHelper){
119 clipboardHelper = document.createElement ("div");
120 clipboardHelper.id = "clipboardHelper";
121 // place outside the visible area
122 clipboardHelper.style.position = "absolute";
123 clipboardHelper.style.left = "-10000px";
124 clipboardHelper.style.top = "-10000px";
125 clipboardHelper.setAttribute("contenteditable", "true");
126 clipboardHelper.style.webkitUserSelect = "auto";
127
128// clipboardHelper.style.width = "500px";
129// clipboardHelper.style.height = "125px";
130// clipboardHelper.style.overflow = "visible";
131// clipboardHelper.style.zIndex = "10000";
132// clipboardHelper.style.border = "1px solid red";
133// clipboardHelper.style.backgroundColor = "yellow";
134
135 document.body.appendChild (clipboardHelper);
136 }
137
138 clipboardHelper.focus();
139 //copy single selection for POC
140 if(this.application.ninja.selectedElements.length > 0){
141 clipboardHelper.innerHTML = this.application.ninja.selectedElements[0].outerHTML;
142 }
143 //do selection
144 document.execCommand('selectAll',false,null);
145 this.copyFlag = true;//flag to prevent infinite loop
146 document.execCommand('copy',false,null);
147
148 }
149 } 102 }
150
151}); \ No newline at end of file 103}); \ No newline at end of file