[FIX] web_editor: restore gradient custom buttons

Since [1] when the `Colorpicker` template cache was moved from
`ColorPalette` to `getColorPickerTemplateService`, the custom buttons
fill color cannot be set as a gradient anymore.
This happens because the needed `getTemplate` props is injected for the
font and background colors, for the `we-colorpicker` but not for the
link tools color palettes.

This commit restores the gradient color selection for custom buttons by
linking the `getColorPickerTemplateService` to the link tools color
palettes.

Steps to reproduce:
- Edit Home page.
- Click on "Contact Us" link in header.
- Select link style "Custom" in link tools.
- Open "Fill Color" palette.

=> Gradient tab was not shown in palette.

[1]: https://github.com/odoo/odoo/commit/1d2e54088b0f0e28464ab6aa884fb2e1110e8e04

task-3641914

closes odoo/odoo#147373

X-original-commit: 087861bcbfe444765fdb0b81e0398c12d8db34e8
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Benoit Socias
2023-12-26 08:36:46 +00:00
parent 19c4b3a2ef
commit f2bee5d2a1
3 changed files with 6 additions and 1 deletions
@@ -24,6 +24,7 @@ export class LinkTools extends Link {
onPreApplyLink: { type: Function, optional: true },
onPostApplyLink: { type: Function, optional: true },
onDestroy: { type: Function, optional: true },
getColorpickerTemplate: { type: Function, optional: true },
};
static defaultProps = {
...Link.defaultProps,
@@ -1375,7 +1375,8 @@ export class Wysiwyg extends Component {
onDestroy: () => {
removeHintClasses();
this.linkToolsInfos.onDestroy();
}
},
getColorpickerTemplate: this.getColorpickerTemplate.bind(this),
};
}
// update the shouldFocusUrl prop to focus on url when double click and click edit link
@@ -167,6 +167,7 @@
onColorLeave="(params) => this._colorpaletteApply('color', params)"
onColorPicked="(params) => this._onColorpaletteColorPicked('color', params)"
onCustomColorPicked="(params) => this._onColorpaletteColorPicked('color', params)"
getTemplate="this.props.getColorpickerTemplate"
/>
</we-selection-items>
</div>
@@ -188,6 +189,7 @@
onColorLeave="(params) => this._colorpaletteApply('background-color', params)"
onColorPicked="(params) => this._onColorpaletteColorPicked('background-color', params)"
onCustomColorPicked="(params) => this._onColorpaletteColorPicked('background-color', params)"
getTemplate="this.props.getColorpickerTemplate"
/>
</we-selection-items>
</div>
@@ -230,6 +232,7 @@
onColorLeave="(params) => this._colorpaletteApply('border-color', params)"
onColorPicked="(params) => this._onColorpaletteColorPicked('border-color', params)"
onCustomColorPicked="(params) => this._onColorpaletteColorPicked('border-color', params)"
getTemplate="this.props.getColorpickerTemplate"
/>
</we-selection-items>
</div>