[FIX] web_editor: restore avoiding updates of link content

[1] mistakenly removed the variable used by the mechanism that was
introduced in [2] to avoid updating link content.

This commit uses the link's `needLabel` instead to achieve the same
goal.

Steps to reproduce:
- Add a mega menu.
- Set the mega menu template to Cards.
- Click on the text of a card.
- DO NOT click on the edit link icon in the popover.
- Click on the href field in the options panel.
- Change the value.

=> Links content was broken (image was removed and texts were grouped).

[1]: https://github.com/odoo/odoo/commit/75166dbcd4962f30624fe19829757acbf8e76022
[2]: https://github.com/odoo/odoo/commit/7a0e58f8d7237514d23d815cdf3d81fc79edb1ec

task-3300977

X-original-commit: 1dbcf2825b2d495c206e110a39efe620e646e7c4
Part-of: odoo/odoo#121362
This commit is contained in:
Benoit Socias
2023-05-15 11:41:54 +02:00
parent 3132763e95
commit 225cea8b74
@@ -508,7 +508,7 @@ const Link = Widget.extend({
* @param {boolean} force
*/
_updateLinkContent($link, linkInfos, { force = false } = {}) {
if (force || (linkInfos.content !== this.data.originalText || linkInfos.url !== this.data.url)) {
if (force || (this.needLabel && (linkInfos.content !== this.data.originalText || linkInfos.url !== this.data.url))) {
if (linkInfos.content === this.data.originalText) {
$link.html(this.data.originalHTML);
} else if (linkInfos.content && linkInfos.content.length) {