[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user