@@ -126,11 +126,11 @@ export class CustomizeMailingPlugin extends Plugin {
126
126
if ( currentValue === "" && defaultValue !== "" ) {
127
127
varRule . style . setProperty ( variable , defaultValue ) ;
128
128
}
129
- this . refreshMailingVariableSelector ( variable , true ) ;
129
+ this . refreshMailingVariableSelector ( variable ) ;
130
130
}
131
131
}
132
132
133
- refreshMailingVariableSelector ( variable , isSetup = false ) {
133
+ refreshMailingVariableSelector ( variable ) {
134
134
const options = CUSTOMIZE_MAILING_VARIABLES [ variable ] ;
135
135
const currentValue = this . getVariableValue ( variable ) ;
136
136
let value = "" ;
@@ -141,37 +141,11 @@ export class CustomizeMailingPlugin extends Plugin {
141
141
const rule = this . getRule ( selector ) ;
142
142
for ( const property of options . properties ) {
143
143
const important = PRIORITY_STYLES [ selector ] ?. has ( property ) ? "important" : "" ;
144
- if ( isSetup && rule . style . getPropertyValue ( property ) ) {
145
- this . setVariable ( variable , rule . style . getPropertyValue ( property ) )
146
- } else {
147
- rule . style . setProperty ( property , value , important ) ;
148
- }
144
+ rule . style . setProperty ( property , value , important ) ;
149
145
}
150
146
}
151
147
}
152
148
153
- getVariableName ( selector , property ) {
154
- let prefix = "text" ;
155
- if ( selector . includes ( "h1" ) ) {
156
- prefix = "h1" ;
157
- } else if ( selector . includes ( "h2" ) ) {
158
- prefix = "h2" ;
159
- } else if ( selector . includes ( "h3" ) ) {
160
- prefix = "h3" ;
161
- } else if ( / ( ( \b p \b ) | ( \b p > \* ) | ( \b l i \b ) | ( \b l i > \* ) ) / . test ( selector ) ) {
162
- prefix = "text" ;
163
- } else if ( / ( a \. .* \. b t n \- .* \- ? p r i m a r y ) / . test ( selector ) ) {
164
- prefix = "btn-primary" ;
165
- } else if ( / ( a \. .* \. b t n \- .* \- ? s e c o n d a r y ) / . test ( selector ) ) {
166
- prefix = "btn-secondary" ;
167
- } else if ( / ( ( a : n o t \( \. b t n \) ) | ( a \. b t n \. b t n \- l i n k ) ) / . test ( selector ) ) {
168
- prefix = "link" ;
169
- } else if ( / h r / . test ( selector ) ) {
170
- prefix = "separator"
171
- }
172
- return `--${ prefix } -${ property } ` ;
173
- }
174
-
175
149
parseDesignElement ( styleEl ) {
176
150
const rules = [ ...styleEl . sheet . cssRules ] ;
177
151
for ( const rule of rules ) {
@@ -251,8 +225,6 @@ export class CustomizeMailingPlugin extends Plugin {
251
225
ruleStyle . getPropertyValue ( property ) ,
252
226
ruleStyle . getPropertyPriority ( property )
253
227
) ;
254
- const variable = this . getVariableName ( selector , property )
255
- this . getRule ( this . cssPrefix ) . style . setProperty ( variable , ruleStyle . getPropertyValue ( property ) ) ;
256
228
}
257
229
}
258
230
}
0 commit comments