aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js16
-rwxr-xr-xjs/controllers/elements/element-controller.js6
-rwxr-xr-xjs/controllers/selection-controller.js9
3 files changed, 27 insertions, 4 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index d5d0cf42..02031922 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -195,6 +195,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
195 value:function(doc){ 195 value:function(doc){
196 var response = doc || null;//default just for testing 196 var response = doc || null;//default just for testing
197 if(!!response && response.success && (response.status!== 500) && !!response.uri){ 197 if(!!response && response.success && (response.status!== 500) && !!response.uri){
198 this.creatingNewFile = true;//flag for timeline to identify new file flow
198 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 199 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
199 }else if(!!response && !response.success){ 200 }else if(!!response && !response.success){
200 //Todo: restrict directory path to the sandbox, in the dialog itself 201 //Todo: restrict directory path to the sandbox, in the dialog itself
@@ -222,6 +223,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
222 value:function(response){ 223 value:function(response){
223 //TODO: Add UI to handle error codes, shouldn't be alert windows 224 //TODO: Add UI to handle error codes, shouldn't be alert windows
224 if(!!response && (response.status === 204)) { 225 if(!!response && (response.status === 204)) {
226
227 if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow
228 this.creatingNewFile = false;
229 }
230
225 //Sending full response object 231 //Sending full response object
226 this.openDocument(response); 232 this.openDocument(response);
227 } else if (!!response && (response.status === 404)){ 233 } else if (!!response && (response.status === 404)){
@@ -332,6 +338,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
332 338
333 this.application.ninja.stage.hideCanvas(true); 339 this.application.ninja.stage.hideCanvas(true);
334 } 340 }
341
342 NJevent("closeDocument", doc.uri);
343
344 doc=null;
335 } 345 }
336 }, 346 },
337 347
@@ -339,7 +349,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
339 // Event Detail: Contains the current ActiveDocument 349 // Event Detail: Contains the current ActiveDocument
340 _onOpenDocument: { 350 _onOpenDocument: {
341 value: function(doc){ 351 value: function(doc){
342 //var data = DocumentManager.activeDocument; 352 this.application.ninja.currentDocument = doc;
343 this._hideCurrentDocument(); 353 this._hideCurrentDocument();
344 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); 354 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
345 355
@@ -423,7 +433,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
423 value: function() { 433 value: function() {
424 if(this.activeDocument) { 434 if(this.activeDocument) {
425 if(this.activeDocument.currentView === "design"){ 435 if(this.activeDocument.currentView === "design"){
426 this.application.ninja.stage.saveScroll(); 436 this.activeDocument.saveAppState();
427 this.activeDocument.container.parentNode.style["display"] = "none"; 437 this.activeDocument.container.parentNode.style["display"] = "none";
428 this.application.ninja.stage.hideCanvas(true); 438 this.application.ninja.stage.hideCanvas(true);
429 this.application.ninja.stage.stageView.hideRulers(); 439 this.application.ninja.stage.stageView.hideRulers();
@@ -440,7 +450,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
440 this.activeDocument.container.style["display"] = "block"; 450 this.activeDocument.container.style["display"] = "block";
441 if(this.activeDocument.currentView === "design"){ 451 if(this.activeDocument.currentView === "design"){
442 this.activeDocument.container.parentNode.style["display"] = "block"; 452 this.activeDocument.container.parentNode.style["display"] = "block";
443 this.application.ninja.stage.restoreScroll(); 453 this.activeDocument.restoreAppState();
444 this.application.ninja.stage.hideCanvas(false); 454 this.application.ninja.stage.hideCanvas(false);
445 this.application.ninja.stage.stageView.showRulers(); 455 this.application.ninja.stage.stageView.showRulers();
446 }else{ 456 }else{
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 46e82ace..ec0335b4 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -27,7 +27,11 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
27 27
28 getProperty: { 28 getProperty: {
29 value: function(el, prop, fallbackOnComputed, isStageElement) { 29 value: function(el, prop, fallbackOnComputed, isStageElement) {
30 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement); 30 if(el.nodeType !== 3){
31 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement);
32 }else{
33 return null;
34 }
31 } 35 }
32 }, 36 },
33 37
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index d69b53e0..f50762f3 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -58,6 +58,7 @@ exports.SelectionController = Montage.create(Component, {
58 handleOpenDocument: { 58 handleOpenDocument: {
59 value: function() { 59 value: function() {
60 // Handle initializing the selection array here. 60 // Handle initializing the selection array here.
61 this.initWithDocument([]);
61 } 62 }
62 }, 63 },
63 64
@@ -70,6 +71,14 @@ exports.SelectionController = Montage.create(Component, {
70 if(currentSelectionArray.length >= 1) { 71 if(currentSelectionArray.length >= 1) {
71 this._selectedItems = currentSelectionArray; 72 this._selectedItems = currentSelectionArray;
72 this._isDocument = false; 73 this._isDocument = false;
74
75
76
77 this.application.ninja.selectedElements = currentSelectionArray;
78 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
79
80
81
73 } 82 }
74 } 83 }
75 84