diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 28 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 2 |
2 files changed, 19 insertions, 11 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7758f346..aa037bd4 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -393,14 +393,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
393 | 393 | ||
394 | onCloseFile: { | 394 | onCloseFile: { |
395 | value: function(doc) { | 395 | value: function(doc) { |
396 | var previousFocusedDocument; | ||
396 | 397 | ||
397 | this._documents.splice(this._documents.indexOf(doc), 1); | 398 | this._documents.splice(this._documents.indexOf(doc), 1); |
398 | 399 | ||
399 | this._activeDocument = null; | 400 | if(this._documents.length > 0) { |
400 | 401 | previousFocusedDocument = this._documents[this._documents.length - 1]; | |
401 | this.application.ninja.stage.hideRulers(); | 402 | this.activeDocument = previousFocusedDocument; |
403 | this.switchDocuments(this.activeDocument, previousFocusedDocument, false); | ||
404 | } else { | ||
405 | this.activeDocument = null; | ||
406 | this.application.ninja.stage.hideRulers(); | ||
402 | 407 | ||
403 | this.application.ninja.stage.hideCanvas(true); | 408 | this.application.ninja.stage.hideCanvas(true); |
409 | } | ||
404 | 410 | ||
405 | //TODO: Use references for those instead of calling getElementById | 411 | //TODO: Use references for those instead of calling getElementById |
406 | if(this._documents.length === 0){ | 412 | if(this._documents.length === 0){ |
@@ -518,14 +524,16 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
518 | this.application.ninja.stage.restoreAllPanels(); | 524 | this.application.ninja.stage.restoreAllPanels(); |
519 | this.application.ninja.stage.hideCanvas(false); | 525 | this.application.ninja.stage.hideCanvas(false); |
520 | this.application.ninja.stage.showRulers(); | 526 | this.application.ninja.stage.showRulers(); |
521 | } else if(currentDocument.currentView === "design" && newDocument.currentView === "code") { | ||
522 | this.application.ninja.stage.showCodeViewBar(true); | ||
523 | this.application.ninja.stage.collapseAllPanels(); | ||
524 | this.application.ninja.stage.hideCanvas(true); | ||
525 | this.application.ninja.stage.hideRulers(); | ||
526 | } | 527 | } |
527 | } | 528 | } |
528 | 529 | ||
530 | if(newDocument.currentView === "code") { | ||
531 | this.application.ninja.stage.showCodeViewBar(true); | ||
532 | this.application.ninja.stage.collapseAllPanels(); | ||
533 | this.application.ninja.stage.hideCanvas(true); | ||
534 | this.application.ninja.stage.hideRulers(); | ||
535 | } | ||
536 | |||
529 | this.application.ninja.stage.clearAllCanvas(); | 537 | this.application.ninja.stage.clearAllCanvas(); |
530 | 538 | ||
531 | if(didCreate) { | 539 | if(didCreate) { |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index dcbe0eaf..8ceb9774 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -81,7 +81,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
81 | set : function(document) { | 81 | set : function(document) { |
82 | ///// If the document is null set default stylesheets to null | 82 | ///// If the document is null set default stylesheets to null |
83 | 83 | ||
84 | if(!document) { | 84 | if(!document || document.currentView === "code") { |
85 | this._activeDocument = null; | 85 | this._activeDocument = null; |
86 | this._stageStylesheet = null; | 86 | this._stageStylesheet = null; |
87 | this.defaultStylesheet = null; | 87 | this.defaultStylesheet = null; |