aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorAnanya Sen2012-03-22 10:38:44 -0700
committerAnanya Sen2012-03-22 10:38:44 -0700
commit2557f463c1cfe2d0dd8ea187c184755bd141dab4 (patch)
treea842cee837b5d0c5a314bdd98b3c96eb98f154da /js/mediators
parent61a419422b1a05a779fd9a66c53de3fa8ab5f65a (diff)
downloadninja-2557f463c1cfe2d0dd8ea187c184755bd141dab4.tar.gz
IKNINJA-1302 : For File>New and File>SaveAll dialogs, 'ESC' key now triggers Cancel button and 'Enter' key now triggers OK button. For File picker, the 'ESC' now triggers the Cancel button.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Conflicts: js/io/ui/new-file-dialog/new-file-workflow-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/keyboard-mediator.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index 65dd34cd..63dcfa88 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -246,6 +246,35 @@ exports.KeyboardMediator = Montage.create(Component, {
246 return; 246 return;
247 } 247 }
248 248
249 // check for ENTER key
250 if((evt.keyCode == Keyboard.ENTER) && !(evt.ctrlKey || evt.metaKey)) {
251 //new file
252 if((this.application.ninja.newFileController.newFileOptionsNav !== null)
253 && !this.application.ninja.newFileController.newFileOptionsNav.okButton.hasAttribute("disabled")){
254
255 this.application.ninja.newFileController.newFileOptionsNav.handleOkButtonAction();
256 }
257 //save as
258 if((this.application.ninja.newFileController.saveAsDialog !== null)
259 && !this.application.ninja.newFileController.saveAsDialog.okButton.hasAttribute("disabled")){
260
261 this.application.ninja.newFileController.saveAsDialog.handleOkButtonAction();
262 }
263 return;
264 }
265 //ESC key
266 if(evt.keyCode === Keyboard.ESCAPE){
267 if(this.application.ninja.filePickerController.pickerNavChoices !== null){
268 this.application.ninja.filePickerController.pickerNavChoices.handleCancelButtonAction();
269 }
270 if(this.application.ninja.newFileController.newFileOptionsNav !== null){
271 this.application.ninja.newFileController.newFileOptionsNav.handleCancelButtonAction();
272 }
273 if(this.application.ninja.newFileController.saveAsDialog !== null){
274 this.application.ninja.newFileController.saveAsDialog.handleCancelButtonAction();
275 }
276 return;
277 }
249 278
250 } 279 }
251 }, 280 },