aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/drag-drop-mediator.js6
-rwxr-xr-xjs/mediators/element-mediator.js28
-rw-r--r--js/mediators/io-mediator.js4
-rwxr-xr-xjs/mediators/keyboard-mediator.js31
4 files changed, 32 insertions, 37 deletions
diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js
index b0aba5b6..59086ef6 100755
--- a/js/mediators/drag-drop-mediator.js
+++ b/js/mediators/drag-drop-mediator.js
@@ -114,11 +114,13 @@ exports.DragDropMediator = Montage.create(Component, {
114 var self = this; 114 var self = this;
115 // 115 //
116 if (e.currentTarget.fileType.indexOf('svg') !== -1) { 116 if (e.currentTarget.fileType.indexOf('svg') !== -1) {
117 element = NJUtils.makeNJElement('embed', 'SVG', 'block');//TODO: Verify this is proper 117 element = NJUtils.make('embed', null, this.application.ninja.currentDocument);//TODO: Verify this is proper
118 NJUtils.createModelWithSelection(element, "SVG");
118 element.type = 'image/svg+xml'; 119 element.type = 'image/svg+xml';
119 element.src = url+'/'+fileName; 120 element.src = url+'/'+fileName;
120 } else { 121 } else {
121 element = NJUtils.makeNJElement('image', 'image', 'image'); 122 element = NJUtils.make('image', null, this.application.ninja.currentDocument);
123 NJUtils.createModel(element);
122 element.src = url+'/'+fileName; 124 element.src = url+'/'+fileName;
123 } 125 }
124 //Adding element once it is loaded 126 //Adding element once it is loaded
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 919aaec1..06514076 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -514,11 +514,33 @@ exports.ElementMediator = Montage.create(Component, {
514 var str = this.getProperty(el, "-webkit-transform"); 514 var str = this.getProperty(el, "-webkit-transform");
515 return str && str.length; 515 return str && str.length;
516 } 516 }
517 } 517 },
518
519 518
519 reArrangeDOM:{
520 value: function(layersDraggedArray, layerDroppedAfter) {
521 var documentRoot,length;
520 522
523 documentRoot = this.application.ninja.currentDocument.documentRoot;
524 length = layersDraggedArray.length;
521 525
522 //-------------------------------------------------------------------------------------------------------- 526 for(var i=0; documentRoot.children[i]; i++) {
527 if(documentRoot.children[i] === layerDroppedAfter.layerData.elementsList[0]) {
528 if(length >0){
529 documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0], documentRoot.children[i]);
530 }
523 531
532 /* Will require for Multiple Drag n Drop */
533 //length = length-1;
534 //index = i;
535 //if(length>0) {
536 //while(layersDraggedArray[length]) {
537 //documentRoot.children[index].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[k].nextSibling);
538 //length--;
539 //index++;
540 //}
541 //}
542 }
543 }
544 }
545 }
524}); \ No newline at end of file 546}); \ No newline at end of file
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 057a849d..c20ae8f7 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -153,10 +153,6 @@ exports.IoMediator = Montage.create(Component, {
153 // 153 //
154 switch (file.mode) { 154 switch (file.mode) {
155 case 'html': 155 case 'html':
156
157
158 //TODO: Add check for Monatage library to copy
159
160 //Getting content from function to properly handle saving assets (as in external if flagged) 156 //Getting content from function to properly handle saving assets (as in external if flagged)
161 contents = this.parseNinjaTemplateToHtml(file); 157 contents = this.parseNinjaTemplateToHtml(file);
162 break; 158 break;
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index f8934669..49960f58 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -87,7 +87,8 @@ exports.KeyboardMediator = Montage.create(Component, {
87 value: function(evt) { 87 value: function(evt) {
88 88
89 //keyboard controls for html design view 89 //keyboard controls for html design view
90 if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ 90 // TODO - New template mode doesn't set currentView yet.
91 if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){
91 92
92 // Don't do anything if an input or other control is focused 93 // Don't do anything if an input or other control is focused
93 if(document.activeElement.nodeName !== "BODY") { 94 if(document.activeElement.nodeName !== "BODY") {
@@ -256,7 +257,7 @@ exports.KeyboardMediator = Montage.create(Component, {
256 handleKeyup: { 257 handleKeyup: {
257 value: function(evt) { 258 value: function(evt) {
258 //keyboard controls for html design view 259 //keyboard controls for html design view
259 if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ 260 if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){
260 if(document.activeElement.nodeName !== "BODY") { 261 if(document.activeElement.nodeName !== "BODY") {
261 // Don't do anything if an input or other control is focused 262 // Don't do anything if an input or other control is focused
262 return; 263 return;
@@ -265,31 +266,5 @@ exports.KeyboardMediator = Montage.create(Component, {
265 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); 266 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt);
266 } 267 }
267 } 268 }
268 },
269
270 _handleKeydown: {
271 value: function(evt) {
272
273 // Check if cmd-shift-+/ctrl-shift-+ for toggling snapping
274 if(evt.shiftKey && (evt.ctrlKey || evt.metaKey) && (evt.keyCode === 187))
275 {
276 MainMenuModule.MenuActionManager.toggleSnapping("snap", !DocumentManagerModule.DocumentManager.activeDocument.snapping);
277 evt.preventDefault();
278 return;
279 }
280
281 if(evt.keyCode === Keyboard.PLUS && (evt.metaKey||evt.ctrlKey)) {
282 evt.preventDefault();
283 this._toolsList.action("zoomIn", evt);
284 return;
285 }
286
287 if(evt.keyCode === Keyboard.MINUS && (evt.metaKey || evt.ctrlKey)) {
288 evt.preventDefault();
289 this._toolsList.action("zoomOut", evt);
290 return;
291 }
292
293 }
294 } 269 }
295}); 270});