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.js67
1 files changed, 21 insertions, 46 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 4f122b3b..e059e7e1 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -18,6 +18,14 @@ exports.DocumentController = Montage.create(Component, {
18 value: false 18 value: false
19 }, 19 },
20 20
21 iframeContainer: {
22 value: null
23 },
24
25 codeContainer: {
26 value: null
27 },
28
21 documents: { 29 documents: {
22 value: [] 30 value: []
23 }, 31 },
@@ -42,13 +50,15 @@ exports.DocumentController = Montage.create(Component, {
42 this._currentDocument = value; 50 this._currentDocument = value;
43 51
44 if(!value) { 52 if(!value) {
45 53 document.getElementById("iframeContainer").style.display = "block";
46 } else { 54 document.getElementById("codeViewContainer").style.display = "block";
55 } else if(this._currentDocument.currentView === "design") {
56 this._currentDocument.model.currentView.show();
57 } else {
58 document.getElementById("iframeContainer").style.display = "none";
47 this._currentDocument.model.currentView.show(); 59 this._currentDocument.model.currentView.show();
48 } 60 }
49 61
50
51
52 } 62 }
53 }, 63 },
54 64
@@ -64,7 +74,13 @@ exports.DocumentController = Montage.create(Component, {
64 this.eventManager.addEventListener("executeFileCloseAll", this, false); 74 this.eventManager.addEventListener("executeFileCloseAll", this, false);
65 } 75 }
66 }, 76 },
67 77
78 didCreate: {
79 value: function() {
80 this.iframeContainer = document.getElementById("iframeContainer");
81 this.codeContainer = document.getElementById("codeViewContainer");
82 }
83 },
68 84
69 //TODO: Ensure these APIs are not needed 85 //TODO: Ensure these APIs are not needed
70 redirectRequests: { 86 redirectRequests: {
@@ -333,47 +349,6 @@ exports.DocumentController = Montage.create(Component, {
333 } 349 }
334 }, 350 },
335 351
336 onCloseFile: {
337 value: function(doc) {
338 var previousFocusedDocument;
339
340// this._documents.splice(this._documents.indexOf(doc), 1);
341 this.application.ninja.docController.removeObjects(this._documents.indexOf(doc));
342
343 if(this._documents.length > 0) {
344 previousFocusedDocument = this._documents[this._documents.length - 1];
345 this.activeDocument = previousFocusedDocument;
346 this.switchDocuments(this.activeDocument, previousFocusedDocument, false);
347 } else {
348 this.activeDocument = null;
349 this.application.ninja.stage.hideRulers();
350
351 this.application.ninja.stage.hideCanvas(true);
352 }
353
354 //TODO: Use references for those instead of calling getElementById
355 if(this._documents.length === 0){
356 document.getElementById("iframeContainer").style.display="block";
357 document.getElementById("codeViewContainer").style.display="block";
358 }
359
360 NJevent("closeDocument", doc.model.file.uri);
361
362 //TODO: Delete object here
363 }
364 },
365
366 _onOpenTextDocument: {
367 value: function(doc) {
368
369 // Main DIFFERENCE --
370 // TODO: Implement Code View here
371 //document.getElementById("iframeContainer").style.display = "none";
372 //this.application.ninja.codeEditorController.applySettings();
373
374 }
375 },
376
377 switchDocuments: { 352 switchDocuments: {
378 value: function(currentDocument, newDocument, didCreate) { 353 value: function(currentDocument, newDocument, didCreate) {
379 354