aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/document-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/document-controller.js')
-rwxr-xr-xjs/controllers/document-controller.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index d5556fa8..ddaeb061 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -38,13 +38,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
38 return this._activeDocument; 38 return this._activeDocument;
39 }, 39 },
40 set: function(doc) { 40 set: function(doc) {
41 if(!!this._activeDocument) this._activeDocument.isActive = false; 41 if(!!this._activeDocument){ this._activeDocument.isActive = false;}
42
43 this._activeDocument = doc; 42 this._activeDocument = doc;
44 if(!!this._activeDocument){ 43 if(!!this._activeDocument){
45
46 if(this._documents.indexOf(doc) === -1) this._documents.push(doc); 44 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
47 this._activeDocument.isActive = true; 45 this._activeDocument.isActive = true;
46
48 if(!!this._activeDocument.editor){ 47 if(!!this._activeDocument.editor){
49 this._activeDocument.editor.focus(); 48 this._activeDocument.editor.focus();
50 } 49 }
@@ -61,6 +60,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
61 this.eventManager.addEventListener("executeSaveAs", this, false); 60 this.eventManager.addEventListener("executeSaveAs", this, false);
62 this.eventManager.addEventListener("executeSaveAll", this, false); 61 this.eventManager.addEventListener("executeSaveAll", this, false);
63 this.eventManager.addEventListener("executeFileClose", this, false); 62 this.eventManager.addEventListener("executeFileClose", this, false);
63 this.eventManager.addEventListener("executeFileCloseAll", this, false);
64 64
65 this.eventManager.addEventListener("styleSheetDirty", this, false); 65 this.eventManager.addEventListener("styleSheetDirty", this, false);
66 66
@@ -71,7 +71,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
71 handleAddComponentFirstDraw: { 71 handleAddComponentFirstDraw: {
72 value: function (e) { 72 value: function (e) {
73 //TODO: Add logic to reparse the document for dynamically added styles 73 //TODO: Add logic to reparse the document for dynamically added styles
74 console.log(e); 74 //console.log(e);
75 } 75 }
76 }, 76 },
77 77
@@ -180,6 +180,17 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
180 } 180 }
181 }, 181 },
182 //////////////////////////////////////////////////////////////////// 182 ////////////////////////////////////////////////////////////////////
183 handleExecuteFileCloseAll:{
184 value: function(event) {
185 var i=0;
186 if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
187 while(this._documents.length > 0){
188 this.closeDocument(this._documents[this._documents.length -1].uuid);
189 }
190 }
191 }
192 },
193 ////////////////////////////////////////////////////////////////////
183 // 194 //
184 fileSaveResult: { 195 fileSaveResult: {
185 value: function (result) { 196 value: function (result) {