diff options
author | Eric Guzman | 2012-05-22 15:58:02 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-22 15:58:02 -0700 |
commit | deb312310c4e031da62afa6e2520c192ad6e4990 (patch) | |
tree | 36db85e848949b62e89649cd3c6fb7cf3dde6a74 /js/controllers | |
parent | ad3b4595d7377e5bf75bcb8ad81007859b0a8a02 (diff) | |
download | ninja-deb312310c4e031da62afa6e2520c192ad6e4990.tar.gz |
CSS Panel - Merged Styles controller from DOM Architecture
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/styles-controller.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 00d67b89..dcbe0eaf 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -128,21 +128,23 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
128 | this._defaultStylesheet = null; | 128 | this._defaultStylesheet = null; |
129 | return false; | 129 | return false; |
130 | } | 130 | } |
131 | ///// Use the last stylesheet in the document as the default | 131 | //check that the document has a design view |
132 | 132 | else if(this._activeDocument.model && this._activeDocument.model.views && this._activeDocument.model.views.design){ | |
133 | var sheets = this._activeDocument._document.styleSheets, | 133 | ///// Use the last stylesheet in the document as the default |
134 | lastIndex = sheets.length-1; | ||
135 | |||
136 | ///// If the only sheet is the stage stylesheet, this will be true | ||
137 | ///// in which case, we want to create a stylesheet to hold the | ||
138 | ///// user's style rules | ||
139 | |||
140 | if(sheets[lastIndex] === this._stageStyleSheet) { | ||
141 | this._defaultStylesheet = this.createStylesheet('nj-default'); | ||
142 | } else { | ||
143 | this._defaultStylesheet = sheets[lastIndex]; | ||
144 | } | ||
145 | 134 | ||
135 | var sheets = this._activeDocument._document.styleSheets, | ||
136 | lastIndex = sheets.length-1; | ||
137 | |||
138 | ///// If the only sheet is the stage stylesheet, this will be true | ||
139 | ///// in which case, we want to create a stylesheet to hold the | ||
140 | ///// user's style rules | ||
141 | |||
142 | if(sheets[lastIndex] === this._stageStyleSheet) { | ||
143 | this._defaultStylesheet = this.createStylesheet('nj-default'); | ||
144 | } else { | ||
145 | this._defaultStylesheet = sheets[lastIndex]; | ||
146 | } | ||
147 | } | ||
146 | } | 148 | } |
147 | } | 149 | } |
148 | }, | 150 | }, |