diff options
4 files changed, 71 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 60b2ca92..22f29bd8 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -1315,6 +1315,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1315 | return sheetObj.stylesheet === sheet; | 1315 | return sheetObj.stylesheet === sheet; |
1316 | }); | 1316 | }); |
1317 | 1317 | ||
1318 | ///// Dispatch modified event | ||
1319 | NJevent('styleSheetModified', eventData); | ||
1320 | |||
1318 | ///// If the sheet doesn't already exist in the list of modified | 1321 | ///// If the sheet doesn't already exist in the list of modified |
1319 | ///// sheets, dispatch dirty event and add the sheet to the list | 1322 | ///// sheets, dispatch dirty event and add the sheet to the list |
1320 | if(sheetSearch.length === 0) { | 1323 | if(sheetSearch.length === 0) { |
@@ -1348,6 +1351,8 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1348 | this.dirtyStyleSheets = this.dirtyStyleSheets.filter(function(sheet) { | 1351 | this.dirtyStyleSheets = this.dirtyStyleSheets.filter(function(sheet) { |
1349 | return sheet.document !== doc; | 1352 | return sheet.document !== doc; |
1350 | }); | 1353 | }); |
1354 | } else { | ||
1355 | this.dirtyStyleSheets = []; | ||
1351 | } | 1356 | } |
1352 | 1357 | ||
1353 | 1358 | ||
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.css b/js/panels/css-panel/style-sheet.reel/style-sheet.css index 1d26b041..2e72cd9c 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.css +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.css | |||
@@ -131,6 +131,11 @@ | |||
131 | font-weight: bold; | 131 | font-weight: bold; |
132 | } | 132 | } |
133 | 133 | ||
134 | .ss-dirty:after { | ||
135 | content: "*"; | ||
136 | color: #A33939; | ||
137 | } | ||
138 | |||
134 | .ss-invisible { | 139 | .ss-invisible { |
135 | display: none; | 140 | display: none; |
136 | } \ No newline at end of file | 141 | } \ No newline at end of file |
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 3ddd8454..0ff195d5 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -57,6 +57,12 @@ exports.StyleSheet = Montage.create(Component, { | |||
57 | this._element.classList.remove('default-style-sheet'); | 57 | this._element.classList.remove('default-style-sheet'); |
58 | } | 58 | } |
59 | 59 | ||
60 | if(this.dirty) { | ||
61 | this.nameText.element.classList.add('ss-dirty'); | ||
62 | } else { | ||
63 | this.nameText.element.classList.remove('ss-dirty'); | ||
64 | } | ||
65 | |||
60 | } | 66 | } |
61 | }, | 67 | }, |
62 | 68 | ||
@@ -137,6 +143,21 @@ exports.StyleSheet = Montage.create(Component, { | |||
137 | this._name = text; | 143 | this._name = text; |
138 | } | 144 | } |
139 | }, | 145 | }, |
146 | _dirty : { | ||
147 | value: null | ||
148 | }, | ||
149 | dirty : { | ||
150 | get: function() { | ||
151 | return this._dirty; | ||
152 | }, | ||
153 | set: function(value) { | ||
154 | if(value === this._dirty) { return false; } | ||
155 | |||
156 | this._dirty = value; | ||
157 | this.needsDraw = true; | ||
158 | } | ||
159 | }, | ||
160 | |||
140 | _readOnly : { value: null }, | 161 | _readOnly : { value: null }, |
141 | readOnly : { | 162 | readOnly : { |
142 | get: function() { | 163 | get: function() { |
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 b2d2c0fb..8131a619 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 | |||
@@ -17,6 +17,8 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
17 | documentNameLabel : { value: null }, | 17 | documentNameLabel : { value: null }, |
18 | noDocumentLabelClass : { value: "no-document" }, | 18 | noDocumentLabelClass : { value: "no-document" }, |
19 | 19 | ||
20 | dirtyStyleSheets: { value: null }, | ||
21 | |||
20 | _documentName : { value: null }, | 22 | _documentName : { value: null }, |
21 | documentName : { | 23 | documentName : { |
22 | get: function() { | 24 | get: function() { |
@@ -52,7 +54,21 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
52 | this.needsDraw = true; | 54 | this.needsDraw = true; |
53 | } | 55 | } |
54 | }, | 56 | }, |
55 | 57 | ||
58 | _dirtyStyleSheets : { value: null }, | ||
59 | dirtyStyleSheets : { | ||
60 | get: function() { | ||
61 | return this._dirtyStyleSheets; | ||
62 | }, | ||
63 | set: function(value) { | ||
64 | if(value === this._dirtyStyleSheets) { return false; } | ||
65 | |||
66 | this._dirtyStyleSheets = value; | ||
67 | |||
68 | this.needsDraw = true; | ||
69 | } | ||
70 | }, | ||
71 | |||
56 | /// Toolbar Button Actions | 72 | /// Toolbar Button Actions |
57 | /// -------------------------------- | 73 | /// -------------------------------- |
58 | 74 | ||
@@ -79,10 +95,22 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
79 | 'oneway': false | 95 | 'oneway': false |
80 | }); | 96 | }); |
81 | 97 | ||
98 | Object.defineBinding(this, 'dirtyStyleSheets', { | ||
99 | 'boundObject': this.stylesController, | ||
100 | 'boundObjectPropertyPath': 'dirtyStyleSheets', | ||
101 | 'oneway': true | ||
102 | }); | ||
103 | |||
82 | this._initView = this.needsDraw = true; | 104 | this._initView = this.needsDraw = true; |
83 | } | 105 | } |
84 | }, | 106 | }, |
85 | 107 | ||
108 | handleStyleSheetModified : { | ||
109 | value: function(e) { | ||
110 | this.needsDraw = true; | ||
111 | } | ||
112 | }, | ||
113 | |||
86 | /// Draw cycle | 114 | /// Draw cycle |
87 | /// -------------------------------- | 115 | /// -------------------------------- |
88 | 116 | ||
@@ -94,6 +122,7 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
94 | prepareForDraw : { | 122 | prepareForDraw : { |
95 | value: function() { | 123 | value: function() { |
96 | this.eventManager.addEventListener("styleSheetsReady", this, false); | 124 | this.eventManager.addEventListener("styleSheetsReady", this, false); |
125 | this.eventManager.addEventListener("styleSheetModified", this, false); | ||
97 | } | 126 | } |
98 | }, | 127 | }, |
99 | draw : { | 128 | draw : { |
@@ -115,6 +144,16 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
115 | this.documentNameLabel.classList.add(this.noDocumentLabelClass); | 144 | this.documentNameLabel.classList.add(this.noDocumentLabelClass); |
116 | } | 145 | } |
117 | 146 | ||
147 | if(this.dirtyStyleSheets) { | ||
148 | var dirtySheets = this.dirtyStyleSheets.map(function(sheetDescriptor) { | ||
149 | return sheetDescriptor.stylesheet; | ||
150 | }); | ||
151 | |||
152 | this.styleSheetList.childComponents.forEach(function(sheetComponent) { | ||
153 | sheetComponent.dirty = dirtySheets.indexOf(sheetComponent.source) !== -1; | ||
154 | }, this); | ||
155 | } | ||
156 | |||
118 | if(this._needsScroll) { | 157 | if(this._needsScroll) { |
119 | 158 | ||
120 | setTimeout(function() { | 159 | setTimeout(function() { |