aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/keyboard-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-rwxr-xr-xjs/mediators/keyboard-mediator.js37
1 files changed, 12 insertions, 25 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index fc0d0f6a..82596693 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -99,12 +99,11 @@ exports.KeyboardMediator = Montage.create(Component, {
99 evt.preventDefault(); 99 evt.preventDefault();
100 } 100 }
101 101
102 // Check DELETE OR BACKSPACE 102 // DELETE or BACKSPACE event handler - Removes the current selected elements from the DOM
103 if((evt.keyCode == Keyboard.BACKSPACE) || (evt.keyCode == Keyboard.DELETE)) { 103 if((evt.keyCode == Keyboard.BACKSPACE) || (evt.keyCode == Keyboard.DELETE)) {
104 evt.stopImmediatePropagation(); 104 evt.stopImmediatePropagation();
105 evt.preventDefault(); 105 evt.preventDefault();
106 NJevent("deleting"); 106 return this.application.ninja.elementMediator.removeElements(document.application.ninja.selectedElements);
107 return;
108 } 107 }
109 108
110 109
@@ -197,9 +196,7 @@ exports.KeyboardMediator = Montage.create(Component, {
197 } 196 }
198 197
199 if(evt.keyCode === Keyboard.ESCAPE){//ESC key 198 if(evt.keyCode === Keyboard.ESCAPE){//ESC key
200 //console.log("ESC key pressed");
201 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); 199 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt);
202 //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar");
203 } 200 }
204 201
205 202
@@ -214,37 +211,27 @@ exports.KeyboardMediator = Montage.create(Component, {
214 211
215 // Check if cmd+z/ctrl+z for Undo (Windows/Mac) 212 // Check if cmd+z/ctrl+z for Undo (Windows/Mac)
216 if ((evt.keyCode == Keyboard.Z) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { 213 if ((evt.keyCode == Keyboard.Z) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {
217 NJevent("executeUndo"); 214 document.application.undoManager.undo();
218 //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar");
219 return;
220 }
221
222 // Check if cmd+s/ctrl+s for Save (Windows/Mac)
223 if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {
224 try{
225 NJevent("executeSave");
226 }
227 catch(e){
228 console.warn("Unable to save");
229 console.log(e.stack);
230 }
231 evt.preventDefault();
232 return; 215 return;
233 } 216 }
234 217
235 // Check if cmd+shift+z for Redo (Mac) 218 // Check if cmd+shift+z for Redo (Mac)
236 if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { 219 if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) {
237 NJevent("executeRedo"); 220 document.application.undoManager.redo();
238 //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar");
239 return; 221 return;
240 } 222 }
241 223
242 // Check if ctrl+y for Redo (Windows) 224 // Check if ctrl+y for Redo (Windows)
243 if ((evt.keyCode == Keyboard.Y) && evt.ctrlKey) { 225 if ((evt.keyCode == Keyboard.Y) && evt.ctrlKey) {
244 NJevent("executeRedo"); 226 document.application.undoManager.redo();
245 //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar");
246 return; 227 return;
247 } 228 }
229
230 // Check if cmd+s/ctrl+s for Save (Windows/Mac)
231 if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {
232 NJevent("executeSave");
233 evt.preventDefault();
234 }
248 } 235 }
249 }, 236 },
250 237