diff options
author | Valerio Virgillito | 2012-04-09 10:32:31 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-09 10:32:31 -0700 |
commit | 86b98ea086b133f4efb247c39fc6200dcf383a65 (patch) | |
tree | 7c6a22bec2b556cbb2f7732fc8595d9f713ad064 /js/io/ui/file-picker/file-input-field.reel/file-input-field.js | |
parent | 7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff) | |
parent | efe18b4c8e52667683727139e9f9e28f66381164 (diff) | |
download | ninja-86b98ea086b133f4efb247c39fc6200dcf383a65.tar.gz |
Merge pull request #160 from ananyasen/integration-candidate
- using Montage TextField component to handle all edits
Diffstat (limited to 'js/io/ui/file-picker/file-input-field.reel/file-input-field.js')
-rwxr-xr-x | js/io/ui/file-picker/file-input-field.reel/file-input-field.js | 37 |
1 files changed, 17 insertions, 20 deletions
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 0f66468a..9e77759f 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 | |||
@@ -14,14 +14,10 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
14 | value: function() { | 14 | value: function() { |
15 | var that = this; | 15 | var that = this; |
16 | this.findDirectory.identifier = "findDirectory"; | 16 | this.findDirectory.identifier = "findDirectory"; |
17 | |||
18 | this.findDirectory.addEventListener("click", this, false); | 17 | this.findDirectory.addEventListener("click", this, false); |
19 | 18 | this.eventManager.addEventListener("pickerSelectionsDone", this.handleFileInputPickerSelectionsDone, false); | |
20 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); | 19 | this.addEventListener("change@newFileDirectory.value", this.handleNewFileDirectoryChange, false); |
21 | 20 | this.newFileDirectory.element.addEventListener("keyup", this, false); | |
22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); | ||
23 | this.newFileDirectory.addEventListener("paste", this, false); | ||
24 | this.newFileDirectory.addEventListener("search", this, false); | ||
25 | } | 21 | } |
26 | }, | 22 | }, |
27 | 23 | ||
@@ -65,15 +61,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
65 | } | 61 | } |
66 | }, | 62 | }, |
67 | 63 | ||
68 | handlePaste:{ | 64 | handleNewFileDirectoryChange:{ |
69 | value:function(evt){ | ||
70 | evt.preventDefault(); | ||
71 | evt.target.value = evt.clipboardData.getData("Text"); | ||
72 | this.handleNewFileDirectoryOnkeyup(evt); | ||
73 | } | ||
74 | }, | ||
75 | |||
76 | handleNewFileDirectoryOnkeyup:{ | ||
77 | value:function(evt){ | 65 | value:function(evt){ |
78 | var newFileDirectorySetEvent = document.createEvent("Events"); | 66 | var newFileDirectorySetEvent = document.createEvent("Events"); |
79 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 67 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
@@ -83,9 +71,18 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
83 | } | 71 | } |
84 | }, | 72 | }, |
85 | 73 | ||
86 | handleSearch:{ | 74 | |
87 | value:function(evt){ | 75 | handleKeyup:{ |
88 | this.handleNewFileDirectoryOnkeyup(evt); | 76 | value: function(evt){ |
77 | if(evt.keyCode === 13){ | ||
78 | var enterKeyupEvent = document.createEvent("Events"); | ||
79 | enterKeyupEvent.initEvent("enterKey", false, false); | ||
80 | this.eventManager.dispatchEvent(enterKeyupEvent); | ||
81 | }else if(evt.keyCode === 27){ | ||
82 | var escKeyupEvent = document.createEvent("Events"); | ||
83 | escKeyupEvent.initEvent("escKey", false, false); | ||
84 | this.eventManager.dispatchEvent(escKeyupEvent); | ||
85 | } | ||
89 | } | 86 | } |
90 | }, | 87 | }, |
91 | 88 | ||
@@ -110,7 +107,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
110 | if(!!obj && obj.uri && obj.uri.length > 0){ | 107 | if(!!obj && obj.uri && obj.uri.length > 0){ |
111 | selectedUri = obj.uri[0]; | 108 | selectedUri = obj.uri[0]; |
112 | this.newFileDirectory.value = selectedUri; | 109 | this.newFileDirectory.value = selectedUri; |
113 | this.newFileDirectory.focus(); | 110 | this.newFileDirectory.element.focus(); |
114 | var newFileDirectorySetEvent = document.createEvent("Events"); | 111 | var newFileDirectorySetEvent = document.createEvent("Events"); |
115 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 112 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
116 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 113 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |