diff options
Diffstat (limited to 'js')
-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 | }, |