Skip to content

Commit 8a40be8

Browse files
committed
Revert "[FIX] mass_mailing_egg: TO DISCUSS set variable based on design-themes v1"
This reverts commit 5a439a8.
1 parent 35dd041 commit 8a40be8

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

addons/mass_mailing_egg/static/src/builder/plugins/customize_mailing_plugin.js

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ export class CustomizeMailingPlugin extends Plugin {
126126
if (currentValue === "" && defaultValue !== "") {
127127
varRule.style.setProperty(variable, defaultValue);
128128
}
129-
this.refreshMailingVariableSelector(variable, true);
129+
this.refreshMailingVariableSelector(variable);
130130
}
131131
}
132132

133-
refreshMailingVariableSelector(variable, isSetup = false) {
133+
refreshMailingVariableSelector(variable) {
134134
const options = CUSTOMIZE_MAILING_VARIABLES[variable];
135135
const currentValue = this.getVariableValue(variable);
136136
let value = "";
@@ -141,37 +141,11 @@ export class CustomizeMailingPlugin extends Plugin {
141141
const rule = this.getRule(selector);
142142
for (const property of options.properties) {
143143
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);
149145
}
150146
}
151147
}
152148

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 (/((\bp\b)|(\bp > \*)|(\bli\b)|(\bli > \*))/.test(selector)) {
162-
prefix = "text";
163-
} else if (/(a\..*\.btn\-.*\-?primary)/.test(selector)) {
164-
prefix = "btn-primary";
165-
} else if (/(a\..*\.btn\-.*\-?secondary)/.test(selector)) {
166-
prefix = "btn-secondary";
167-
} else if (/((a:not\(\.btn\))|(a\.btn\.btn\-link))/.test(selector)) {
168-
prefix = "link";
169-
} else if (/hr/.test(selector)) {
170-
prefix = "separator"
171-
}
172-
return `--${prefix}-${property}`;
173-
}
174-
175149
parseDesignElement(styleEl) {
176150
const rules = [...styleEl.sheet.cssRules];
177151
for (const rule of rules) {
@@ -251,8 +225,6 @@ export class CustomizeMailingPlugin extends Plugin {
251225
ruleStyle.getPropertyValue(property),
252226
ruleStyle.getPropertyPriority(property)
253227
);
254-
const variable = this.getVariableName(selector, property)
255-
this.getRule(this.cssPrefix).style.setProperty(variable, ruleStyle.getPropertyValue(property));
256228
}
257229
}
258230
}

0 commit comments

Comments
 (0)