aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel')
-rw-r--r--js/panels/css-panel/rule-list.reel/rule-list.js2
-rw-r--r--js/panels/css-panel/style-sheet.reel/style-sheet.html3
-rw-r--r--js/panels/css-panel/style-sheet.reel/style-sheet.js20
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js10
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js6
-rw-r--r--js/panels/css-panel/styles-view-delegate.js3
6 files changed, 36 insertions, 8 deletions
diff --git a/js/panels/css-panel/rule-list.reel/rule-list.js b/js/panels/css-panel/rule-list.reel/rule-list.js
index ae0c4611..b9dc2b95 100644
--- a/js/panels/css-panel/rule-list.reel/rule-list.js
+++ b/js/panels/css-panel/rule-list.reel/rule-list.js
@@ -106,7 +106,7 @@ exports.RuleList = Montage.create(Component, {
106 // found rule in our component list, or it's the inline rule 106 // found rule in our component list, or it's the inline rule
107 ruleComponent.update(); 107 ruleComponent.update();
108 foundIndices.push(index); 108 foundIndices.push(index);
109 } else if(!ruleComponent.applied) { /// remove rule (unless unapplied) 109 } else if(ruleComponent.applied) { /// remove rule (unless unapplied)
110 this.rulesToRemove.push(ruleComponent); 110 this.rulesToRemove.push(ruleComponent);
111 } 111 }
112 }, this); 112 }, this);
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.html b/js/panels/css-panel/style-sheet.reel/style-sheet.html
index 035bc760..01b5f20c 100644
--- a/js/panels/css-panel/style-sheet.reel/style-sheet.html
+++ b/js/panels/css-panel/style-sheet.reel/style-sheet.html
@@ -62,6 +62,9 @@ POSSIBILITY OF SUCH DAMAGE.
62 "prototype": "js/components/textfield.reel[TextField]", 62 "prototype": "js/components/textfield.reel[TextField]",
63 "properties": { 63 "properties": {
64 "element": {"#": "media-input"} 64 "element": {"#": "media-input"}
65 },
66 "bindings": {
67 "value": {"<->": "@owner.mediaText"}
65 } 68 }
66 }, 69 },
67 "editButton": { 70 "editButton": {
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js
index b7df05a7..3a0060b2 100644
--- a/js/panels/css-panel/style-sheet.reel/style-sheet.js
+++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js
@@ -71,6 +71,9 @@ exports.StyleSheet = Montage.create(Component, {
71 prepareForDraw : { 71 prepareForDraw : {
72 value: function() { 72 value: function() {
73 this.nameText.element.addEventListener('click', this, false); 73 this.nameText.element.addEventListener('click', this, false);
74
75 //// Set the initial media text value
76 this.mediaText = this._source.media.mediaText;
74 } 77 }
75 }, 78 },
76 79
@@ -89,8 +92,6 @@ exports.StyleSheet = Montage.create(Component, {
89 value: function() { 92 value: function() {
90 var transStr = '-webkit-transform'; 93 var transStr = '-webkit-transform';
91 94
92 this.mediaInput.value = this._source.media.mediaText;
93
94 if(this.editing) { 95 if(this.editing) {
95 this.editView.classList.add('expanded'); 96 this.editView.classList.add('expanded');
96 this.editView.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)'); 97 this.editView.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)');
@@ -194,6 +195,21 @@ exports.StyleSheet = Montage.create(Component, {
194 this._name = text; 195 this._name = text;
195 } 196 }
196 }, 197 },
198
199 _mediaText : { value: null },
200 mediaText : {
201 get : function() { return this._mediaText; },
202 set : function(value) {
203 if(value === this._mediaText) { return; }
204
205 this.application.ninja.stylesController.setMediaAttribute(this._source, value);
206
207 this._mediaText = value;
208
209 this.needsDraw = true;
210 }
211 },
212
197 _dirty : { 213 _dirty : {
198 value: null 214 value: null
199 }, 215 },
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
index cd86261c..fd559b24 100644
--- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
+++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
@@ -96,13 +96,16 @@ exports.StyleSheetsView = Montage.create(Component, {
96 96
97 var sheetComponent, oldDefaultSheet; 97 var sheetComponent, oldDefaultSheet;
98 98
99 ///// Mark the appropriate component as the default, un-mark the previous default
99 if(this.styleSheetList) { 100 if(this.styleSheetList) {
100 sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)]; 101 sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)];
101 if(sheetComponent) { 102 if(sheetComponent) {
102 sheetComponent['default'] = true; 103 sheetComponent['default'] = true;
103 if(this._defaultStyleSheet) { 104 if(this._defaultStyleSheet) {
104 oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)]; 105 oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)];
105 oldDefaultSheet['default'] = false; 106 if(oldDefaultSheet) {
107 oldDefaultSheet['default'] = false;
108 }
106 } 109 }
107 } 110 }
108 } 111 }
@@ -141,7 +144,6 @@ exports.StyleSheetsView = Montage.create(Component, {
141 handleDeleteAction : { 144 handleDeleteAction : {
142 value: function(sheetComponent) { 145 value: function(sheetComponent) {
143 this.stylesController.removeStyleSheet(sheetComponent.source); 146 this.stylesController.removeStyleSheet(sheetComponent.source);
144 this.stylesController._clearCache();
145 this._dispatchChange(); 147 this._dispatchChange();
146 } 148 }
147 }, 149 },
@@ -176,7 +178,7 @@ exports.StyleSheetsView = Montage.create(Component, {
176 } 178 }
177 }, 179 },
178 180
179 handleStyleSheetModified : { 181 handleStyleSheetDirty : {
180 value: function(e) { 182 value: function(e) {
181 this.needsDraw = true; 183 this.needsDraw = true;
182 } 184 }
@@ -193,7 +195,7 @@ exports.StyleSheetsView = Montage.create(Component, {
193 prepareForDraw : { 195 prepareForDraw : {
194 value: function() { 196 value: function() {
195 this.eventManager.addEventListener("styleSheetsReady", this, false); 197 this.eventManager.addEventListener("styleSheetsReady", this, false);
196 this.eventManager.addEventListener("styleSheetModified", this, false); 198 this.eventManager.addEventListener("styleSheetDirty", this, false);
197 } 199 }
198 }, 200 },
199 draw : { 201 draw : {
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
index bba178f2..94abb4b0 100644
--- a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
@@ -141,6 +141,12 @@ exports.StylesViewContainer = Montage.create(Component, {
141 value: function() { 141 value: function() {
142 this.eventManager.addEventListener('styleSheetsReady', this, false); 142 this.eventManager.addEventListener('styleSheetsReady', this, false);
143 this.eventManager.addEventListener('elementChange', this, false); 143 this.eventManager.addEventListener('elementChange', this, false);
144 this.eventManager.addEventListener('mediaChange', this, false);
145 }
146 },
147 handleMediaChange : {
148 value: function(e) {
149 this.ruleListContainer.update();
144 } 150 }
145 }, 151 },
146 handleStyleSheetsReady: { 152 handleStyleSheetsReady: {
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js
index 6b80663a..113300b2 100644
--- a/js/panels/css-panel/styles-view-delegate.js
+++ b/js/panels/css-panel/styles-view-delegate.js
@@ -337,7 +337,8 @@ exports.StylesViewDelegate = Montage.create(Component, {
337 type : 'cssChange', 337 type : 'cssChange',
338 data: { 338 data: {
339 "prop": property, 339 "prop": property,
340 "value": value 340 "value": value,
341 "els": this.application.ninja.selectedElements
341 }, 342 },
342 redraw: null 343 redraw: null
343 }); 344 });