aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js21
-rwxr-xr-xjs/controllers/selection-controller.js18
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js5
3 files changed, 34 insertions, 10 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 194496a6..1f8c58b0 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -61,7 +61,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
61 this.eventManager.addEventListener("executeSaveAs", this, false); 61 this.eventManager.addEventListener("executeSaveAs", this, false);
62 this.eventManager.addEventListener("executeSaveAll", this, false); 62 this.eventManager.addEventListener("executeSaveAll", this, false);
63 63
64 this.eventManager.addEventListener("recordStyleChanged", this, false); 64 this.eventManager.addEventListener("styleSheetDirty", this, false);
65 65
66 } 66 }
67 }, 67 },
@@ -168,6 +168,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
168 value: function (result) { 168 value: function (result) {
169 if(result.status === 204){ 169 if(result.status === 204){
170 this.activeDocument.needsSave = false; 170 this.activeDocument.needsSave = false;
171 if(this.application.ninja.currentDocument !== null){
172 //clear Dirty StyleSheets for the saved document
173 this.application.ninja.stylesController.clearDirtyStyleSheets(this.application.ninja.currentDocument);
174 }
171 } 175 }
172 } 176 }
173 }, 177 },
@@ -249,6 +253,15 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
249 }, 253 },
250 //////////////////////////////////////////////////////////////////// 254 ////////////////////////////////////////////////////////////////////
251 // 255 //
256 saveAsCallback:{
257 value:function(){
258 //close current document
259
260 //create a new file
261 }
262 },
263
264 ////////////////////////////////////////////////////////////////////
252 openDocument: { 265 openDocument: {
253 value: function(doc) { 266 value: function(doc) {
254 267
@@ -506,5 +519,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
506 value: function() { 519 value: function() {
507 return "userDocument_" + (this._iframeCounter++); 520 return "userDocument_" + (this._iframeCounter++);
508 } 521 }
522 },
523
524 handleStyleSheetDirty:{
525 value:function(){
526 this.activeDocument.needsSave = true;
509 } 527 }
528 }
510}); 529});
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 08eb018f..3f9d8514 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -91,15 +91,17 @@ exports.SelectionController = Montage.create(Component, {
91 91
92 handleSwitchDocument: { 92 handleSwitchDocument: {
93 value: function() { 93 value: function() {
94 this._selectedItems = this.application.ninja.selectedElements.slice(0); 94 if(this.application.ninja.documentController.activeDocument.currentView === "design"){
95 if(this._selectedItems.length === 0 ){ 95 this._selectedItems = this.application.ninja.selectedElements.slice(0);
96 this._isDocument = true; 96 if(this._selectedItems.length === 0 ){
97 }else{ 97 this._isDocument = true;
98 this._isDocument = false; 98 }else{
99 } 99 this._isDocument = false;
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 100 }
101 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101 102
102 this._selectionContainer = this.application.ninja.currentSelectedContainer; 103 this._selectionContainer = this.application.ninja.currentSelectedContainer;
104 }
103 } 105 }
104 }, 106 },
105 107
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 91047e51..ad67cada 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -125,6 +125,10 @@ exports.StageView = Montage.create(Component, {
125 125
126 this.application.ninja.documentController.activeDocument = doc; 126 this.application.ninja.documentController.activeDocument = doc;
127 127
128 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
129 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
130 }
131
128 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 132 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
129 this.application.ninja.documentController._showCurrentDocument(); 133 this.application.ninja.documentController._showCurrentDocument();
130 134
@@ -135,7 +139,6 @@ exports.StageView = Montage.create(Component, {
135 139
136 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 140 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
137 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 141 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
138 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
139 142
140 //reinitialize draw-util, snapmanager and view-util 143 //reinitialize draw-util, snapmanager and view-util
141 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument(); 144 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();