diff options
author | Nivesh Rajbhandari | 2012-05-23 16:09:45 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-23 16:09:45 -0700 |
commit | d874b959bc297fed31d3ef3c2a7c8c77df88f761 (patch) | |
tree | d36a0b464aed1f3ff91c81df3aaf52df72451472 /js | |
parent | f97590388467b5a3316f6f155162fc293915fddc (diff) | |
parent | 0ca1910df1c78116139664bf39a95cf0ec7c8dc8 (diff) | |
download | ninja-d874b959bc297fed31d3ef3c2a7c8c77df88f761.tar.gz |
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
Diffstat (limited to 'js')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 2 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 28 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 2 | ||||
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 2 | ||||
-rwxr-xr-x | js/panels/Splitter.js | 7 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 2 |
6 files changed, 27 insertions, 16 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index d2a6b1e4..aaefd923 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -21,7 +21,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
21 | 21 | ||
22 | handleCloseDocument: { | 22 | handleCloseDocument: { |
23 | value: function(){ | 23 | value: function(){ |
24 | if(!this.application.ninja.documentController.activeDocument) { | 24 | if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { |
25 | this.disabled = true; | 25 | this.disabled = true; |
26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); | 26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); |
27 | } | 27 | } |
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; |
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 23a2ce75..2f55edb4 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -88,7 +88,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
88 | 88 | ||
89 | //keyboard controls for html design view | 89 | //keyboard controls for html design view |
90 | // TODO - New template mode doesn't set currentView yet. | 90 | // TODO - New template mode doesn't set currentView yet. |
91 | if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ | 91 | if((!!this.application.ninja.currentDocument) && (this.application.ninja.currentDocument.model.currentView === "design")){ |
92 | 92 | ||
93 | // Don't do anything if an input or other control is focused | 93 | // Don't do anything if an input or other control is focused |
94 | if(document.activeElement.nodeName !== "BODY") { | 94 | if(document.activeElement.nodeName !== "BODY") { |
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 0640abb2..f0fb1a45 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js | |||
@@ -111,8 +111,9 @@ exports.Splitter = Montage.create(Component, { | |||
111 | } else { | 111 | } else { |
112 | this.panel.removeEventListener("webkitTransitionEnd", this, false); | 112 | this.panel.removeEventListener("webkitTransitionEnd", this, false); |
113 | } | 113 | } |
114 | 114 | if(this.application.ninja.currentDocument && this.application.ninja.currentDocument.currentView === "design"){ | |
115 | this.application.ninja.stage.resizeCanvases = true; | 115 | this.application.ninja.stage.resizeCanvases = true; |
116 | } | ||
116 | } | 117 | } |
117 | }, | 118 | }, |
118 | 119 | ||
@@ -149,6 +150,7 @@ exports.Splitter = Montage.create(Component, { | |||
149 | this.panel.addEventListener("webkitTransitionEnd", this, false); | 150 | this.panel.addEventListener("webkitTransitionEnd", this, false); |
150 | } | 151 | } |
151 | this._collapsed = true; | 152 | this._collapsed = true; |
153 | this.disabled = true; | ||
152 | this.needsDraw = true; | 154 | this.needsDraw = true; |
153 | } | 155 | } |
154 | } | 156 | } |
@@ -169,6 +171,7 @@ exports.Splitter = Montage.create(Component, { | |||
169 | } else { | 171 | } else { |
170 | this.panel.addEventListener("webkitTransitionEnd", this, false); | 172 | this.panel.addEventListener("webkitTransitionEnd", this, false); |
171 | } | 173 | } |
174 | this.disabled = false; | ||
172 | this.needsDraw = true; | 175 | this.needsDraw = true; |
173 | } | 176 | } |
174 | } | 177 | } |
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 80133edf..2c02e544 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -596,7 +596,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
596 | 596 | ||
597 | // That's all we need to do for a brand new file. | 597 | // That's all we need to do for a brand new file. |
598 | // But what if we're opening an existing document? | 598 | // But what if we're opening an existing document? |
599 | if (!this.application.ninja.documentController.creatingNewFile) { | 599 | if (!this.application.ninja.documentController.creatingNewFile && this.application.ninja.currentDocument.currentView !== "code") { |
600 | // Opening an existing document. If it has DOM elements we need to restore their timeline info | 600 | // Opening an existing document. If it has DOM elements we need to restore their timeline info |
601 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { | 601 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { |
602 | // Yes, it has DOM elements. Loop through them and create a new object for each. | 602 | // Yes, it has DOM elements. Loop through them and create a new object for each. |