File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
html_editor/static/src/main/font
website/static/src/builder/plugins Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
23
23
rgbaToHex ,
24
24
COLOR_COMBINATION_CLASSES_REGEX ,
25
25
} from "@web/core/utils/colors" ;
26
+ import { backgroundImageCssToParts } from "@html_editor/utils/image" ;
26
27
import { ColorSelector } from "./color_selector" ;
27
28
28
29
const RGBA_OPACITY = 0.6 ;
@@ -136,7 +137,8 @@ export class ColorPlugin extends Plugin {
136
137
getElementColors ( el ) {
137
138
const elStyle = getComputedStyle ( el ) ;
138
139
const backgroundImage = elStyle . backgroundImage ;
139
- const hasGradient = isColorGradient ( backgroundImage ) ;
140
+ const gradient = backgroundImageCssToParts ( backgroundImage ) . gradient ;
141
+ const hasGradient = isColorGradient ( gradient ) ;
140
142
const hasTextGradientClass = el . classList . contains ( "text-gradient" ) ;
141
143
142
144
let backgroundColor = elStyle . backgroundColor ;
@@ -155,9 +157,9 @@ export class ColorPlugin extends Plugin {
155
157
}
156
158
157
159
return {
158
- color : hasGradient && hasTextGradientClass ? backgroundImage : rgbaToHex ( elStyle . color ) ,
160
+ color : hasGradient && hasTextGradientClass ? gradient : rgbaToHex ( elStyle . color ) ,
159
161
backgroundColor :
160
- hasGradient && ! hasTextGradientClass ? backgroundImage : rgbaToHex ( backgroundColor ) ,
162
+ hasGradient && ! hasTextGradientClass ? gradient : rgbaToHex ( backgroundColor ) ,
161
163
} ;
162
164
}
163
165
Original file line number Diff line number Diff line change @@ -87,7 +87,13 @@ export class CustomizeWebsitePlugin extends Plugin {
87
87
if ( gradientColor ) {
88
88
const gradientValue = this . getWebsiteVariableValue ( gradientColor ) ;
89
89
if ( gradientValue ) {
90
- return gradientValue ;
90
+ // Pass through style to restore rgb/a which might
91
+ // have been lost during SCSS generation process.
92
+ // TODO Remove this once colorpicker will be able
93
+ // to cope with #rrggbb gradient color elements.
94
+ const el = document . createElement ( "div" ) ;
95
+ el . style . setProperty ( "background-image" , gradientValue ) ;
96
+ return el . style . getPropertyValue ( "background-image" ) ;
91
97
}
92
98
}
93
99
return getCSSVariableValue ( color , style ) ;
You can’t perform that action at this time.
0 commit comments