aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-01 21:39:03 -0700
committerValerio Virgillito2012-04-01 21:39:03 -0700
commitc6de22bf42be90b403491b5f87b1818d9020310c (patch)
tree6249f420894a8b8fae29baa83b705012098eedb4
parent07badcfa96a7a9c9a99c6bd3812158e06704cdf6 (diff)
parentd4a682ddca0248e0dd7d8871dddbd167bd020a18 (diff)
downloadninja-c6de22bf42be90b403491b5f87b1818d9020310c.tar.gz
Merge pull request #148 from ananyasen/integration-candidate
added text paste detection and updated some menu items
-rwxr-xr-xjs/data/menu-data.js40
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.js9
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js11
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js4
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js13
5 files changed, 36 insertions, 41 deletions
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 12007f4a..3333d209 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -154,17 +154,17 @@ exports.MenuData = Montage.create( Montage, {
154 { 154 {
155 "displayText" : "Cut", 155 "displayText" : "Cut",
156 "hasSubMenu" : false, 156 "hasSubMenu" : false,
157 "enabled": true 157 "enabled": false
158 }, 158 },
159 { 159 {
160 "displayText" : "Copy", 160 "displayText" : "Copy",
161 "hasSubMenu" : false, 161 "hasSubMenu" : false,
162 "enabled": true 162 "enabled": false
163 }, 163 },
164 { 164 {
165 "displayText" : "Paste", 165 "displayText" : "Paste",
166 "hasSubMenu" : false, 166 "hasSubMenu" : false,
167 "enabled": true 167 "enabled": false
168 } 168 }
169 ] 169 ]
170 }, 170 },
@@ -172,38 +172,6 @@ exports.MenuData = Montage.create( Montage, {
172 "header": "View", 172 "header": "View",
173 "entries": [ 173 "entries": [
174 { 174 {
175 "displayText" : "Zoom In",
176 "hasSubMenu" : false,
177 "enabled": {
178 "value": false,
179 "boundObj": "documentController",
180 "boundProperty": "activeDocument",
181 "oneway": true,
182 "boundValueMutator": function(activeDocument){
183 if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;}
184 else{return false;}
185 }
186 }
187 },
188 {
189 "displayText" : "Zoom Out",
190 "hasSubMenu" : false,
191 "enabled": {
192 "value": false,
193 "boundObj": "documentController",
194 "boundProperty": "activeDocument",
195 "oneway": true,
196 "boundValueMutator": function(activeDocument){
197 if((activeDocument !== null) && (activeDocument.currentView === "design")){return true;}
198 else{return false;}
199 }
200 }
201 },
202 {
203 "displayText" : "",
204 "separator": true
205 },
206 {
207 "displayText" : "Live Preview", 175 "displayText" : "Live Preview",
208 "hasSubMenu" : false, 176 "hasSubMenu" : false,
209 "enabled": { 177 "enabled": {
@@ -431,7 +399,7 @@ exports.MenuData = Montage.create( Montage, {
431 { 399 {
432 "displayText" : "Debug", 400 "displayText" : "Debug",
433 "hasSubMenu" : false, 401 "hasSubMenu" : false,
434 "enabled": true, 402 "enabled": false,
435 "checked": { 403 "checked": {
436 "value": true, 404 "value": true,
437 "boundProperty": "debug" 405 "boundProperty": "debug"
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
index ccb925b9..46e8b386 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
@@ -20,6 +20,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
20 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); 20 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false);
21 21
22 this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); 22 this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false);
23 this.newFileDirectory.addEventListener("paste", this, false);
23 } 24 }
24 }, 25 },
25 26
@@ -63,6 +64,14 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
63 } 64 }
64 }, 65 },
65 66
67 handlePaste:{
68 value:function(evt){
69 evt.preventDefault();
70 evt.target.value = evt.clipboardData.getData("Text");
71 this.handleNewFileDirectoryOnkeyup(evt);
72 }
73 },
74
66 handleNewFileDirectoryOnkeyup:{ 75 handleNewFileDirectoryOnkeyup:{
67 value:function(evt){ 76 value:function(evt){
68 if(this.newFileDirectory.value !== ""){ 77 if(this.newFileDirectory.value !== ""){
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
index fac4c488..02579676 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
@@ -23,11 +23,20 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
23 this.fileInputField.selectDirectory = true; 23 this.fileInputField.selectDirectory = true;
24 24
25 this.newFileName.addEventListener("keyup", this, false); 25 this.newFileName.addEventListener("keyup", this, false);
26 this.newFileName.focus(); 26 this.newFileName.addEventListener("paste", this, false);
27 this.newFileName.focus();
27 this.newFileName.select(); 28 this.newFileName.select();
28 } 29 }
29 }, 30 },
30 31
32 handlePaste:{
33 value:function(evt){
34 evt.preventDefault();
35 evt.target.value = evt.clipboardData.getData("Text");
36 this.handleKeyup(evt);
37 }
38 },
39
31 handleKeyup:{ 40 handleKeyup:{
32 value:function(evt){ 41 value:function(evt){
33 if(this.newFileName.value !== "") { 42 if(this.newFileName.value !== "") {
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
index 18556bc5..c98955ca 100644
--- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -326,8 +326,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
326 326
327 handleNewFileDirectorySet:{ 327 handleNewFileDirectorySet:{
328 value:function(evt){ 328 value:function(evt){
329 if((evt.keyCode === 13) && !this.okButton.hasAttribute("disabled")){ 329 if(evt.keyCode === 13){
330 this.handleOkButtonAction(evt); 330 if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt);
331 }else if(evt.keyCode === 27){ 331 }else if(evt.keyCode === 27){
332 this.handleCancelButtonAction(evt); 332 this.handleCancelButtonAction(evt);
333 } 333 }
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
index d59d5be1..c5ed8d33 100644
--- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js
+++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
@@ -55,6 +55,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
55 this.fileInputField.newFileDirectory.value = this.folderUri; 55 this.fileInputField.newFileDirectory.value = this.folderUri;
56 56
57 this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); 57 this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false);
58 this.newFileName.addEventListener("paste", this, false);
58 this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); 59 this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false);
59 60
60 this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); 61 this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false);
@@ -84,8 +85,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
84 85
85 handleNewFileDirectorySet:{ 86 handleNewFileDirectorySet:{
86 value:function(evt){ 87 value:function(evt){
87 if((evt.keyCode === 13) && !this.okButton.hasAttribute("disabled")){ 88 if(evt.keyCode === 13){
88 this.handleOkButtonAction(evt); 89 if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt);
89 }else if(evt.keyCode === 27){ 90 }else if(evt.keyCode === 27){
90 this.handleCancelButtonAction(evt); 91 this.handleCancelButtonAction(evt);
91 } 92 }
@@ -98,6 +99,14 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
98 } 99 }
99 }, 100 },
100 101
102 handlePaste:{
103 value:function(evt){
104 evt.preventDefault();
105 evt.target.value = evt.clipboardData.getData("Text");
106 this.handleNewFileNameOnkeyup(evt);
107 }
108 },
109
101 handleNewFileNameOnkeyup:{ 110 handleNewFileNameOnkeyup:{
102 value:function(evt){ 111 value:function(evt){
103 this.fileName = this.newFileName.value; 112 this.fileName = this.newFileName.value;