Skip to content

Commit

Permalink
Make clearProperties configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jul 18, 2017
1 parent 21bf336 commit 02f1117
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/style_manager/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ module.exports = {
// is set to false, highlightComputed will not take effect
showComputed: true,

// Adds the possibility to clear property value from the target style
clearProperties: false,

// Properties which are valid to be shown as computed
// (Identified as inherited properties: https://developer.mozilla.org/en-US/docs/Web/CSS/inheritance)
validComputed: ['border-collapse', 'border-spacing', 'caption-side', 'color', 'cursor', 'direction', 'empty-cells',
Expand Down
6 changes: 5 additions & 1 deletion src/style_manager/view/PropertyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = Backbone.View.extend({
const status = this.model.get('status');
const pfx = this.pfx;
const ppfx = this.ppfx;
const config = this.config;
const updatedCls = `${ppfx}active-color`;
const computedCls = `${ppfx}warn-color`;
const labelEl = this.$el.find(`> .${pfx}label`);
Expand All @@ -64,7 +65,10 @@ module.exports = Backbone.View.extend({
switch (status) {
case 'updated':
labelEl.addClass(updatedCls);
clearStyle.display = 'inline';

if (config.clearProperties) {
clearStyle.display = 'inline';
}
break;
case 'computed':
labelEl.addClass(computedCls);
Expand Down

0 comments on commit 02f1117

Please sign in to comment.