aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/panels/css-panel/styles-view-delegate.js27
1 files changed, 20 insertions, 7 deletions
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js
index 56727d40..583eb0ba 100644
--- a/js/panels/css-panel/styles-view-delegate.js
+++ b/js/panels/css-panel/styles-view-delegate.js
@@ -53,6 +53,19 @@ exports.StylesViewMediator = Montage.create(Component, {
53 return false; 53 return false;
54 } 54 }
55 55
56 if(!ruleComponent.firstChangeHappened) {
57 var lastClass = newSelector.substring(newSelector.lastIndexOf('.')+1);
58
59 if(lastClass !== newSelector) {
60 ///// Add the generated class to each element in selection
61 ///// and check whether it applies to the element
62 this.ruleListContainer.displayedList.selection.forEach(function(el) {
63 this.stylesController.addClass(el, lastClass);
64 },this);
65 }
66 ruleComponent.firstChangeHappened = true;
67 }
68
56 rule.selectorText = newSelector; 69 rule.selectorText = newSelector;
57 70
58 ruleComponent.applied = this.ruleListContainer.displayedList.selection.every(function(el) { 71 ruleComponent.applied = this.ruleListContainer.displayedList.selection.every(function(el) {
@@ -225,13 +238,13 @@ exports.StylesViewMediator = Montage.create(Component, {
225 238
226 ///// Add the generated class to each element in selection 239 ///// Add the generated class to each element in selection
227 ///// and check whether it applies to the element 240 ///// and check whether it applies to the element
228 this.ruleListContainer.displayedList.selection.forEach(function(el) { 241// this.ruleListContainer.displayedList.selection.forEach(function(el) {
229 this.stylesController.addClass(el, selector); 242// this.stylesController.addClass(el, selector);
230 243//
231 if(applies) { 244// if(applies) {
232 applies = (this._doesSelectorTargetElement('.'+selector, el)); 245// applies = (this._doesSelectorTargetElement('.'+selector, el));
233 } 246// }
234 },this); 247// },this);
235 248
236 ///// Add rule directly to the rule list 249 ///// Add rule directly to the rule list
237 this.ruleListContainer.displayedList.component.addRule(newRule, null, applies, function(ruleComponent) { 250 this.ruleListContainer.displayedList.component.addRule(newRule, null, applies, function(ruleComponent) {