diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 4d209042509..df1dc99d524 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -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; } diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index f4360801cf2..b0379ad2405 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -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