File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
plugins/dominant-color-images Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -221,11 +221,11 @@ function dominant_color_admin_script(): void {
221
221
const tmpl = document.getElementById( 'tmpl-attachment' );
222
222
if ( tmpl ) {
223
223
tmpl.textContent = tmpl.textContent.replace( /^\s*<div[^>]*?(?=>)/, ( match ) => {
224
- let replaced = match.replace( /\sclass="/, " class=\"{{ data.hasTransparency ? \ 'has-transparency\ ' : \ 'not-transparent\ ' }} " );
224
+ let replaced = match.replace( /\sclass="/, " class=\"{{ data.hasTransparency ? 'has-transparency' : 'not-transparent' }} " );
225
225
replaced += ' data-dominant-color="{{ data.dominantColor }}"';
226
226
replaced += ' data-has-transparency="{{ data.hasTransparency }}"';
227
227
let hasStyleAttr = false;
228
- const colorStyle = '--dominant-color: #{{ data.dominantColor }};' ;
228
+ const colorStyle = "{{ data.dominantColor ? '--dominant-color: #' + data.dominantColor + ';' : '' }}" ;
229
229
replaced = replaced.replace( /\sstyle="/, ( styleMatch ) => {
230
230
hasStyleAttr = true;
231
231
return styleMatch + colorStyle;
You can’t perform that action at this time.
0 commit comments