diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/styles-controller.js | 15 | ||||
-rw-r--r-- | js/panels/css-panel/style-sheet.reel/style-sheet.js | 2 | ||||
-rw-r--r-- | js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js | 5 |
3 files changed, 20 insertions, 2 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 8639bed1..87019cad 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -1433,6 +1433,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1433 | sheetEl.disabled = true; | 1433 | sheetEl.disabled = true; |
1434 | this.userStyleSheets.splice(this.userStyleSheets.indexOf(sheet), 1); | 1434 | this.userStyleSheets.splice(this.userStyleSheets.indexOf(sheet), 1); |
1435 | 1435 | ||
1436 | ///// Make sure cached rules from this stylesheet are not used | ||
1437 | this._clearCache(); | ||
1438 | |||
1436 | ///// Check to see if we're removing the default style sheet | 1439 | ///// Check to see if we're removing the default style sheet |
1437 | if(sheet === this._defaultStylesheet) { | 1440 | if(sheet === this._defaultStylesheet) { |
1438 | sheetCount = this.userStyleSheets.length; | 1441 | sheetCount = this.userStyleSheets.length; |
@@ -1470,6 +1473,18 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1470 | } | 1473 | } |
1471 | }, | 1474 | }, |
1472 | 1475 | ||
1476 | setMediaAttribute : { | ||
1477 | value: function(sheet, mediaString) { | ||
1478 | if(sheet.media.mediaText === mediaString) { return false; } | ||
1479 | |||
1480 | sheet.ownerNode.setAttribute('media', mediaString); | ||
1481 | |||
1482 | this._clearCache(); | ||
1483 | |||
1484 | this.styleSheetModified(sheet); | ||
1485 | } | ||
1486 | }, | ||
1487 | |||
1473 | ///// Style Sheet Modified | 1488 | ///// Style Sheet Modified |
1474 | ///// Method to call whenever a stylesheet change is made | 1489 | ///// Method to call whenever a stylesheet change is made |
1475 | ///// Dispatches an event, and keeps list of dirty style sheets | 1490 | ///// Dispatches an event, and keeps list of dirty style sheets |
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 8a8e7dbf..3a0060b2 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -202,7 +202,7 @@ exports.StyleSheet = Montage.create(Component, { | |||
202 | set : function(value) { | 202 | set : function(value) { |
203 | if(value === this._mediaText) { return; } | 203 | if(value === this._mediaText) { return; } |
204 | 204 | ||
205 | this._source.ownerNode.setAttribute('media', value); | 205 | this.application.ninja.stylesController.setMediaAttribute(this._source, value); |
206 | 206 | ||
207 | this._mediaText = value; | 207 | this._mediaText = value; |
208 | 208 | ||
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 e2193ba0..a328cb65 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 | } |