Add: Css color display
This commit is contained in:
@@ -208,10 +208,12 @@ export default class Elements extends Tool
|
|||||||
|
|
||||||
var computedStyle = cssStore.getComputedStyle();
|
var computedStyle = cssStore.getComputedStyle();
|
||||||
if (this._rmDefComputedStyle) computedStyle = rmDefComputedStyle(computedStyle);
|
if (this._rmDefComputedStyle) computedStyle = rmDefComputedStyle(computedStyle);
|
||||||
|
processStyleRules(computedStyle);
|
||||||
ret.computedStyle = computedStyle;
|
ret.computedStyle = computedStyle;
|
||||||
|
|
||||||
var styles = cssStore.getMatchedCSSRules();
|
var styles = cssStore.getMatchedCSSRules();
|
||||||
styles.unshift(getInlineStyle(el.style));
|
styles.unshift(getInlineStyle(el.style));
|
||||||
|
styles.forEach(style => processStyleRules(style.style));
|
||||||
ret.styles = styles;
|
ret.styles = styles;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -252,7 +254,18 @@ export default class Elements extends Tool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isElExist = val => util.isEl(val) && val.parentNode;
|
function processStyleRules(style)
|
||||||
|
{
|
||||||
|
util.each(style, (val, key) =>
|
||||||
|
{
|
||||||
|
if (util.startWith(val, 'rgb'))
|
||||||
|
{
|
||||||
|
style[key] = `<span class="eruda-style-color" style="background-color: ${val}"></span>${val}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const isElExist = val => util.isEl(val) && val.parentNode;
|
||||||
|
|
||||||
function formatElName(data)
|
function formatElName(data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
{{#each computedStyle}}
|
{{#each computedStyle}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="eruda-key">{{@key}}</td>
|
<td class="eruda-key">{{@key}}</td>
|
||||||
<td>{{this}}</td>
|
<td>{{{.}}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<div>{{selectorText}} {</div>
|
<div>{{selectorText}} {</div>
|
||||||
{{#each style}}
|
{{#each style}}
|
||||||
<div class="eruda-rule">
|
<div class="eruda-rule">
|
||||||
<span>{{@key}}</span>: {{this}};
|
<span>{{@key}}</span>: {{{.}}};
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<div>}</div>
|
<div>}</div>
|
||||||
|
|||||||
@@ -58,6 +58,13 @@
|
|||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.style-color {
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
margin-right: 2px;
|
||||||
|
border: 1px solid $gray-dark;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
.computed-style {
|
.computed-style {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user