diff options
Diffstat (limited to 'js/panels/css-panel')
3 files changed, 26 insertions, 9 deletions
diff --git a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js index 5361e5cc..d86c8d55 100644 --- a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js +++ b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js | |||
@@ -96,7 +96,10 @@ exports.CssStyleRule = Montage.create(Component, { | |||
96 | handleStop : { | 96 | handleStop : { |
97 | value: function(e) { | 97 | value: function(e) { |
98 | if(this.focusDelegate) { | 98 | if(this.focusDelegate) { |
99 | e._event.detail.preventDefault(); | 99 | if(e._event.detail.preventDefault) { |
100 | e._event.detail.preventDefault(); | ||
101 | } | ||
102 | |||
100 | this.focusDelegate.handleSelectorStop(this.rule, this.selectorField.value, this); | 103 | this.focusDelegate.handleSelectorStop(this.rule, this.selectorField.value, this); |
101 | } | 104 | } |
102 | } | 105 | } |
diff --git a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js index 509ca565..f53937e6 100644 --- a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js +++ b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js | |||
@@ -39,11 +39,13 @@ exports.RuleListContainer = Montage.create(Component, { | |||
39 | value: function(selection) { | 39 | value: function(selection) { |
40 | var list = this._getListForSelection(selection); | 40 | var list = this._getListForSelection(selection); |
41 | 41 | ||
42 | if(!list) { | 42 | if(list) { |
43 | this.displayedList = list; | ||
44 | this.update(); | ||
45 | } else { | ||
43 | list = this.add(selection); | 46 | list = this.add(selection); |
47 | this.displayedList = list; | ||
44 | } | 48 | } |
45 | |||
46 | this.displayedList = list; | ||
47 | } | 49 | } |
48 | }, | 50 | }, |
49 | 51 | ||
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index a7c1f0d9..4f41ff12 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js | |||
@@ -171,7 +171,8 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
171 | }, | 171 | }, |
172 | handlePropertyChange : { | 172 | handlePropertyChange : { |
173 | value: function(rule, property, value, oldProperty, style) { | 173 | value: function(rule, property, value, oldProperty, style) { |
174 | var browserValue; | 174 | var declaration = style.parentComponent.parentComponent, |
175 | browserValue; | ||
175 | 176 | ||
176 | if(style.editingNewStyle) { | 177 | if(style.editingNewStyle) { |
177 | if(property === '') { | 178 | if(property === '') { |
@@ -187,14 +188,17 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
187 | 188 | ||
188 | if(property === '') { | 189 | if(property === '') { |
189 | style.deleting = true; | 190 | style.deleting = true; |
190 | style.parentComponent.parentComponent.removeStyle(style.source); | 191 | declaration.removeStyle(style.source); |
191 | this._dispatchChange(oldProperty, browserValue); | 192 | this._dispatchChange(oldProperty); |
192 | return false; | 193 | return false; |
193 | } | 194 | } |
194 | 195 | ||
195 | // now add new property | 196 | // now add new property |
196 | browserValue = this.stylesController.setStyle(rule, property, value); | 197 | browserValue = this.stylesController.setStyle(rule, property, value); |
197 | 198 | ||
199 | //// Update the css text so it knows when to update | ||
200 | declaration.cssText = rule.style.cssText; | ||
201 | |||
198 | ///// Mark style as invalid if the browser doesn't accept it | 202 | ///// Mark style as invalid if the browser doesn't accept it |
199 | style.invalid = (browserValue === null); | 203 | style.invalid = (browserValue === null); |
200 | 204 | ||
@@ -203,13 +207,18 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
203 | }, | 207 | }, |
204 | handleValueChange : { | 208 | handleValueChange : { |
205 | value: function(rule, property, value, style) { | 209 | value: function(rule, property, value, style) { |
206 | var browserValue, units; | 210 | var declaration = style.parentComponent.parentComponent, |
211 | browserValue, units; | ||
207 | 212 | ||
208 | if(value === '') { | 213 | if(value === '') { |
209 | ///// Remove old property | 214 | ///// Remove old property |
210 | style.deleting = true; | 215 | style.deleting = true; |
211 | this.stylesController.deleteStyle(rule, property); | 216 | this.stylesController.deleteStyle(rule, property); |
212 | style.parentComponent.parentComponent.removeStyle(style.source); | 217 | declaration.removeStyle(style.source); |
218 | |||
219 | //// Update the css text so it knows when to update | ||
220 | declaration.cssText = rule.style.cssText; | ||
221 | |||
213 | this._dispatchChange(property, browserValue); | 222 | this._dispatchChange(property, browserValue); |
214 | return false; | 223 | return false; |
215 | } | 224 | } |
@@ -218,6 +227,9 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
218 | browserValue = this.stylesController.setStyle(rule, property, value); | 227 | browserValue = this.stylesController.setStyle(rule, property, value); |
219 | style.browserValue = browserValue; | 228 | style.browserValue = browserValue; |
220 | 229 | ||
230 | //// Update the css text so it knows when to update | ||
231 | declaration.cssText = rule.style.cssText; | ||
232 | |||
221 | ///// Mark style as invalid if the browser doesn't accept it | 233 | ///// Mark style as invalid if the browser doesn't accept it |
222 | style.invalid = (browserValue === null); | 234 | style.invalid = (browserValue === null); |
223 | 235 | ||