diff options
author | Ananya Sen | 2012-02-17 11:07:42 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-17 11:07:42 -0800 |
commit | f3b6a62f110be31a9438a6172694b111ffd4d507 (patch) | |
tree | 56b30ce23149e7c778a04c59977b35a5fd258571 /js/mediators | |
parent | 4641dbefb6e8cb41f1f3d7f4d070d50bcaed94be (diff) | |
download | ninja-f3b6a62f110be31a9438a6172694b111ffd4d507.tar.gz |
-added keyboard control for saving documents
-mark html design view when element is added or deleted
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index a1fdead3..e348a09b 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -85,7 +85,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
85 | 85 | ||
86 | handleKeydown: { | 86 | handleKeydown: { |
87 | value: function(evt) { | 87 | value: function(evt) { |
88 | if(document.activeElement.nodeName !== "BODY") { | 88 | if((document.activeElement.nodeName !== "BODY") && (this.application.ninja.documentController.activeDocument.currentView === "design")) { |
89 | // Don't do anything if an input or other control is focused | 89 | // Don't do anything if an input or other control is focused |
90 | return; | 90 | return; |
91 | } | 91 | } |
@@ -110,6 +110,13 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | 112 | ||
113 | // Check if cmd+s/ctrl+s for Save (Windows/Mac) | ||
114 | if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { | ||
115 | NJevent("executeSave"); | ||
116 | evt.preventDefault(); | ||
117 | return; | ||
118 | } | ||
119 | |||
113 | // Check if cmd+shift+z for Redo (Mac) | 120 | // Check if cmd+shift+z for Redo (Mac) |
114 | if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { | 121 | if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { |
115 | NJevent("executeRedo"); | 122 | NJevent("executeRedo"); |