diff options
author | Eric Guzman | 2012-05-22 15:15:28 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-22 15:15:28 -0700 |
commit | 041c7e125386c1add7653ec90f5b882ffa82530d (patch) | |
tree | 76c9875fd162eca8091a86acca916a1a96e436c0 | |
parent | efe8f144e9506ce1c611445a1c8e4291ce3d1af7 (diff) | |
download | ninja-041c7e125386c1add7653ec90f5b882ffa82530d.tar.gz |
CSS Panel - Fix applying selector to element when selector not changed
-rw-r--r-- | js/panels/css-panel/styles-view-delegate.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 1644460a..5229b92e 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js | |||
@@ -78,7 +78,6 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
78 | _getClassNameFromSelector : { | 78 | _getClassNameFromSelector : { |
79 | value: function(selectorText) { | 79 | value: function(selectorText) { |
80 | var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText); | 80 | var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText); |
81 | |||
82 | return (results) ? results[1] : null; | 81 | return (results) ? results[1] : null; |
83 | } | 82 | } |
84 | }, | 83 | }, |
@@ -243,24 +242,16 @@ exports.StylesViewDelegate = Montage.create(Component, { | |||
243 | ///// Create the rule with generated selector | 242 | ///// Create the rule with generated selector |
244 | newRule = this.application.ninja.stylesController.addRule('.'+selector, ' { }'); | 243 | newRule = this.application.ninja.stylesController.addRule('.'+selector, ' { }'); |
245 | 244 | ||
246 | ///// Add the generated class to each element in selection | ||
247 | ///// and check whether it applies to the element | ||
248 | // this.ruleListContainer.displayedList.selection.forEach(function(el) { | ||
249 | // this.stylesController.addClass(el, selector); | ||
250 | // | ||
251 | // if(applies) { | ||
252 | // applies = (this._doesSelectorTargetElement('.'+selector, el)); | ||
253 | // } | ||
254 | // },this); | ||
255 | |||
256 | ///// Add rule directly to the rule list | 245 | ///// Add rule directly to the rule list |
257 | this.ruleListContainer.displayedList.component.addRule(newRule, null, applies, function(ruleComponent) { | 246 | this.ruleListContainer.displayedList.component.addRule(newRule, null, applies, function(ruleComponent) { |
258 | var rC = ruleComponent; | 247 | var rC = ruleComponent; |
259 | 248 | ||
249 | // TODO: use stop event to apply class to element | ||
260 | rC.addClassNameOnChange = true; | 250 | rC.addClassNameOnChange = true; |
261 | 251 | ||
262 | setTimeout(function() { | 252 | setTimeout(function() { |
263 | rC.selectorField.start(); | 253 | rC.selectorField.start(); |
254 | rC.selectorField._preEditValue = ""; | ||
264 | },50); | 255 | },50); |
265 | 256 | ||
266 | }); | 257 | }); |