[IMP] web_editor, website: handle currentColor in selectStyle

The goal of this commit is to update the `selectStyle` options to handle
the default CSS `"currentColor"` value.

task-3285817

Part-of: odoo/odoo#142968
This commit is contained in:
Mehdi Outagant (MOU)
2024-03-11 19:06:07 +00:00
parent f3c06f743c
commit b5432e8d8f
2 changed files with 5 additions and 13 deletions
@@ -4060,6 +4060,11 @@ const SnippetOptionWidget = Widget.extend({
}
}
}
// When the default color is the target's "currentColor", the
// value should be handled correctly by the option.
if (value === "currentColor") {
return styles.color;
}
return value;
}
@@ -3793,19 +3793,6 @@ options.registry.TextHighlight = options.Class.extend({
applyTextHighlight(this.$target[0], highlightID);
}
},
/**
* @override
*/
async _computeWidgetState(methodName, params) {
const value = await this._super(...arguments);
if (methodName === "selectStyle" && value === "currentColor") {
const style = window.getComputedStyle(this.$target[0]);
// The highlight default color is the text's "currentColor".
// This value should be handled correctly by the option.
return style.color;
}
return value;
},
//--------------------------------------------------------------------------
// Handlers