diff options
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 29 |
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 | }, |