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 | 39 |
1 files changed, 21 insertions, 18 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 02579676..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,31 +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.addEventListener("paste", this, false); | 26 | this.newFileName.element.addEventListener("keyup", this, false); |
27 | this.newFileName.focus(); | 27 | this.newFileName.element.focus(); |
28 | this.newFileName.select(); | 28 | this.newFileName.element.select(); |
29 | } | 29 | } |
30 | }, | 30 | }, |
31 | 31 | ||
32 | handlePaste:{ | 32 | handleKeyup:{ |
33 | value:function(evt){ | 33 | value: function(evt){ |
34 | evt.preventDefault(); | 34 | if(evt.keyCode === 13){ |
35 | evt.target.value = evt.clipboardData.getData("Text"); | 35 | var enterKeyupEvent = document.createEvent("Events"); |
36 | this.handleKeyup(evt); | 36 | enterKeyupEvent.initEvent("enterKey", false, false); |
37 | this.eventManager.dispatchEvent(enterKeyupEvent); | ||
38 | }else if(evt.keyCode === 27){ | ||
39 | var escKeyupEvent = document.createEvent("Events"); | ||
40 | escKeyupEvent.initEvent("escKey", false, false); | ||
41 | this.eventManager.dispatchEvent(escKeyupEvent); | ||
42 | } | ||
37 | } | 43 | } |
38 | }, | 44 | }, |
39 | 45 | ||
40 | handleKeyup:{ | 46 | newFileNameChange:{ |
41 | value:function(evt){ | 47 | value:function(evt){ |
42 | if(this.newFileName.value !== "") { | 48 | var newFileNameSetEvent = document.createEvent("Events"); |
43 | var newFileNameSetEvent = document.createEvent("Events"); | 49 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); |
44 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | 50 | newFileNameSetEvent.newFileName = this.newFileName.value; |
45 | newFileNameSetEvent.newFileName = this.newFileName.value; | 51 | newFileNameSetEvent.keyCode = evt.keyCode; |
46 | newFileNameSetEvent.keyCode = evt.keyCode; | 52 | this.eventManager.dispatchEvent(newFileNameSetEvent); |
47 | this.eventManager.dispatchEvent(newFileNameSetEvent); | ||
48 | } | ||
49 | } | 53 | } |
50 | } | 54 | } |
51 | |||
52 | }); \ No newline at end of file | 55 | }); \ No newline at end of file |