diff options
Diffstat (limited to 'js/io/ui/save-as-dialog.reel')
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 26 |
1 files changed, 13 insertions, 13 deletions
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 c5ed8d33..81d1afee 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 | |||
@@ -16,13 +16,13 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
16 | fileName : { | 16 | fileName : { |
17 | enumerable: true, | 17 | enumerable: true, |
18 | writable: true, | 18 | writable: true, |
19 | value: "" | 19 | value: null |
20 | }, | 20 | }, |
21 | 21 | ||
22 | folderUri:{ | 22 | folderUri:{ |
23 | enumerable: true, | 23 | enumerable: true, |
24 | writable: true, | 24 | writable: true, |
25 | value: "" | 25 | value: null |
26 | }, | 26 | }, |
27 | 27 | ||
28 | callback : { | 28 | callback : { |
@@ -56,6 +56,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
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.newFileName.addEventListener("paste", this, false); |
59 | this.newFileName.addEventListener("search", this, false); | ||
59 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | 60 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); |
60 | 61 | ||
61 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | 62 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); |
@@ -90,7 +91,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
90 | }else if(evt.keyCode === 27){ | 91 | }else if(evt.keyCode === 27){ |
91 | this.handleCancelButtonAction(evt); | 92 | this.handleCancelButtonAction(evt); |
92 | } | 93 | } |
93 | else if(!!evt._event.newFileDirectory){ | 94 | else{ |
94 | this.folderUri = evt._event.newFileDirectory; | 95 | this.folderUri = evt._event.newFileDirectory; |
95 | if(this.isValidUri(this.folderUri)){ | 96 | if(this.isValidUri(this.folderUri)){ |
96 | this.enableOk(); | 97 | this.enableOk(); |
@@ -110,10 +111,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
110 | handleNewFileNameOnkeyup:{ | 111 | handleNewFileNameOnkeyup:{ |
111 | value:function(evt){ | 112 | value:function(evt){ |
112 | this.fileName = this.newFileName.value; | 113 | this.fileName = this.newFileName.value; |
113 | if(this.fileName !== ""){ | 114 | if(this.isValidFileName(this.fileName)){ |
114 | if(this.isValidFileName(this.fileName)){ | ||
115 | this.enableOk(); | 115 | this.enableOk(); |
116 | } | ||
117 | } | 116 | } |
118 | if(evt.keyCode === 13){ | 117 | if(evt.keyCode === 13){ |
119 | if(!this.okButton.hasAttribute("disabled")){ | 118 | if(!this.okButton.hasAttribute("disabled")){ |
@@ -125,6 +124,11 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
125 | } | 124 | } |
126 | }, | 125 | }, |
127 | 126 | ||
127 | handleSearch:{ | ||
128 | value:function(evt){ | ||
129 | this.handleNewFileNameOnkeyup(evt); | ||
130 | } | ||
131 | }, | ||
128 | 132 | ||
129 | enableOk:{ | 133 | enableOk:{ |
130 | value: function(){ | 134 | value: function(){ |
@@ -194,10 +198,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
194 | isValidUri:{ | 198 | isValidUri:{ |
195 | value: function(uri){ | 199 | value: function(uri){ |
196 | var status= this.application.ninja.coreIoApi.isValidUri(uri); | 200 | var status= this.application.ninja.coreIoApi.isValidUri(uri); |
197 | if(uri !== ""){ | 201 | if((uri !== null) && !status){ |
198 | if(!status){ | ||
199 | this.showError("! Invalid directory."); | 202 | this.showError("! Invalid directory."); |
200 | } | ||
201 | } | 203 | } |
202 | return status; | 204 | return status; |
203 | } | 205 | } |
@@ -205,10 +207,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
205 | isValidFileName:{ | 207 | isValidFileName:{ |
206 | value: function(fileName){ | 208 | value: function(fileName){ |
207 | var status = this.validateFileName(fileName); | 209 | var status = this.validateFileName(fileName); |
208 | if(fileName !== ""){ | 210 | if((fileName !== null) && !status){ |
209 | if(!status){ | ||
210 | this.showError("! Invalid file name."); | 211 | this.showError("! Invalid file name."); |
211 | } | ||
212 | } | 212 | } |
213 | return status; | 213 | return status; |
214 | } | 214 | } |
@@ -257,7 +257,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
257 | validateFileName:{ | 257 | validateFileName:{ |
258 | value: function(fileName){ | 258 | value: function(fileName){ |
259 | var status = false; | 259 | var status = false; |
260 | if(fileName !== ""){ | 260 | if((fileName !== null) && (fileName !== "")){ |
261 | fileName = fileName.replace(/^\s+|\s+$/g,""); | 261 | fileName = fileName.replace(/^\s+|\s+$/g,""); |
262 | status = !(/[/\\]/g.test(fileName)); | 262 | status = !(/[/\\]/g.test(fileName)); |
263 | if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden | 263 | if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden |