diff options
Diffstat (limited to 'js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js')
-rwxr-xr-x | js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 31 |
1 files changed, 23 insertions, 8 deletions
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 0e1e09a4..3ac38d02 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 | |||
@@ -22,19 +22,34 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
22 | value: function() { | 22 | value: function() { |
23 | this.fileInputField.selectDirectory = true; | 23 | this.fileInputField.selectDirectory = true; |
24 | 24 | ||
25 | this.newFileName.addEventListener("keyup", this, false); | 25 | this.addEventListener("change@newFileName.value", this.newFileNameChange, false); |
26 | this.newFileName.element.addEventListener("keyup", this, false); | ||
27 | this.newFileName.element.focus(); | ||
28 | this.newFileName.element.select(); | ||
26 | } | 29 | } |
27 | }, | 30 | }, |
28 | 31 | ||
29 | handleKeyup:{ | 32 | handleKeyup:{ |
30 | value:function(evt){ | 33 | value: function(evt){ |
31 | if(this.newFileName.value !== "") { | 34 | if(evt.keyCode === 13){ |
32 | var newFileNameSetEvent = document.createEvent("Events"); | 35 | var enterKeyupEvent = document.createEvent("Events"); |
33 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | 36 | enterKeyupEvent.initEvent("enterKey", false, false); |
34 | newFileNameSetEvent.newFileName = this.newFileName.value; | 37 | this.eventManager.dispatchEvent(enterKeyupEvent); |
35 | this.eventManager.dispatchEvent(newFileNameSetEvent); | 38 | }else if(evt.keyCode === 27){ |
39 | var escKeyupEvent = document.createEvent("Events"); | ||
40 | escKeyupEvent.initEvent("escKey", false, false); | ||
41 | this.eventManager.dispatchEvent(escKeyupEvent); | ||
36 | } | 42 | } |
37 | } | 43 | } |
38 | } | 44 | }, |
39 | 45 | ||
46 | newFileNameChange:{ | ||
47 | value:function(evt){ | ||
48 | var newFileNameSetEvent = document.createEvent("Events"); | ||
49 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | ||
50 | newFileNameSetEvent.newFileName = this.newFileName.value; | ||
51 | newFileNameSetEvent.keyCode = evt.keyCode; | ||
52 | this.eventManager.dispatchEvent(newFileNameSetEvent); | ||
53 | } | ||
54 | } | ||
40 | }); \ No newline at end of file | 55 | }); \ No newline at end of file |