aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/styles-view-mediator.js
diff options
context:
space:
mode:
authorEric Guzman2012-05-01 11:15:14 -0700
committerEric Guzman2012-05-01 11:15:14 -0700
commit9a94c6fb5f82d18139b48341788a0ffca23ae0af (patch)
treec76f84915d7135c81e38f1abc003b6a3b34ff2c3 /js/panels/css-panel/styles-view-mediator.js
parent23d8efd4ed9e8fd43f516595009679fb44c8096d (diff)
downloadninja-9a94c6fb5f82d18139b48341788a0ffca23ae0af.tar.gz
CSS Panel - Added removing of rules/styles
Diffstat (limited to 'js/panels/css-panel/styles-view-mediator.js')
-rw-r--r--js/panels/css-panel/styles-view-mediator.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-mediator.js b/js/panels/css-panel/styles-view-mediator.js
index 8a0e4137..c3154db0 100644
--- a/js/panels/css-panel/styles-view-mediator.js
+++ b/js/panels/css-panel/styles-view-mediator.js
@@ -23,6 +23,12 @@ exports.StylesViewMediator = Montage.create(Component, {
23 23
24 handleSelectorChange : { 24 handleSelectorChange : {
25 value: function(rule, newSelector, ruleComponent) { 25 value: function(rule, newSelector, ruleComponent) {
26 if(newSelector === "") {
27 debugger;
28 ruleComponent.parentComponent.removeRule(ruleComponent);
29 return false;
30 }
31
26 rule.selectorText = newSelector; 32 rule.selectorText = newSelector;
27 33
28 ruleComponent.applied = this.ruleListContainer.displayedList.selection.every(function(el) { 34 ruleComponent.applied = this.ruleListContainer.displayedList.selection.every(function(el) {
@@ -103,6 +109,12 @@ exports.StylesViewMediator = Montage.create(Component, {
103 return false; 109 return false;
104 } 110 }
105 111
112 if(property === '') {
113 style.remove();
114 this._dispatchChange(oldProperty, browserValue);
115 return false;
116 }
117
106 ///// Remove old property and add new one 118 ///// Remove old property and add new one
107 this.stylesController.deleteStyle(rule, oldProperty); 119 this.stylesController.deleteStyle(rule, oldProperty);
108 browserValue = this.stylesController.setStyle(rule, property, value); 120 browserValue = this.stylesController.setStyle(rule, property, value);
@@ -119,6 +131,12 @@ exports.StylesViewMediator = Montage.create(Component, {
119 value: function(rule, property, value, style) { 131 value: function(rule, property, value, style) {
120 var browserValue, units; 132 var browserValue, units;
121 133
134 if(value === '') {
135 style.remove();
136 this._dispatchChange(property, browserValue);
137 return false;
138 }
139
122 ///// Auto-fill units if not provided and units 140 ///// Auto-fill units if not provided and units
123 ///// not previously stored 141 ///// not previously stored
124 units = style.getUnits(value); 142 units = style.getUnits(value);