From 8fdf2fc8aefee68aec4c7b5891e0375f704cbf26 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 20 Jul 2012 11:23:39 -0700 Subject: CSS Panel - Fix updating when media changes, sheets are deleted. --- js/panels/css-panel/rule-list.reel/rule-list.js | 2 +- js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js | 1 - .../css-panel/styles-view-container.reel/styles-view-container.js | 6 ++++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'js/panels') 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, { // found rule in our component list, or it's the inline rule ruleComponent.update(); foundIndices.push(index); - } else if(!ruleComponent.applied) { /// remove rule (unless unapplied) + } else if(ruleComponent.applied) { /// remove rule (unless unapplied) this.rulesToRemove.push(ruleComponent); } }, this); 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 a328cb65..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 @@ -144,7 +144,6 @@ exports.StyleSheetsView = Montage.create(Component, { handleDeleteAction : { value: function(sheetComponent) { this.stylesController.removeStyleSheet(sheetComponent.source); - this.stylesController._clearCache(); this._dispatchChange(); } }, 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, { value: function() { this.eventManager.addEventListener('styleSheetsReady', this, false); this.eventManager.addEventListener('elementChange', this, false); + this.eventManager.addEventListener('mediaChange', this, false); + } + }, + handleMediaChange : { + value: function(e) { + this.ruleListContainer.update(); } }, handleStyleSheetsReady: { -- cgit v1.2.3