diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/link_tools.js b/addons/web_editor/static/src/js/wysiwyg/widgets/link_tools.js index 34070cc3b9e..42c8b7d9121 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/link_tools.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link_tools.js @@ -41,6 +41,11 @@ export class LinkTools extends Link { 'background-color': { colorNames: null }, 'border-color': { colorNames: null }, }; + state = useState({ + showLinkSizeRow: true, + showLinkCustomColor: true, + showLinkShapeRow: true, + }); setup() { super.setup(...arguments); @@ -264,13 +269,12 @@ export class LinkTools extends Link { if (el) { this.colorCombinationClass = el.dataset.value; // Hide the size option if the link is an unstyled anchor. - for (const rowEl of this.linkComponentWrapperRef.el.querySelectorAll('.link-size-row')) { - rowEl.classList.toggle('d-none', !this.colorCombinationClass); - } - // Show custom colors and shape only for Custom style. - for (const rowEl of this.linkComponentWrapperRef.el.querySelectorAll('.link-custom-color, .link-shape-row')) { - rowEl.classList.toggle('d-none', el.dataset.value !== 'custom'); - } + this.state.showLinkSizeRow = Boolean(this.colorCombinationClass); + + // // Show custom colors and shape only for Custom style. + this.state.showLinkCustomColor = el.dataset.value === 'custom'; + this.state.showLinkShapeRow = el.dataset.value === 'custom'; + this.props.onColorCombinationClassChange(this.colorCombinationClass); this._updateColorpicker('color'); diff --git a/addons/web_editor/static/src/xml/wysiwyg.xml b/addons/web_editor/static/src/xml/wysiwyg.xml index f3891722363..49de60343b0 100644 --- a/addons/web_editor/static/src/xml/wysiwyg.xml +++ b/addons/web_editor/static/src/xml/wysiwyg.xml @@ -151,7 +151,7 @@ - + Text Color - + Fill Color - + Border
@@ -235,7 +235,7 @@
- + Size
@@ -261,7 +261,7 @@
- + Shape