From 225cea8b748b5b697db46bc3a051aa753f1716bc Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Thu, 4 May 2023 13:21:13 +0000 Subject: [PATCH] [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 --- addons/web_editor/static/src/js/wysiwyg/widgets/link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js index 4249964a0d9..7afd64b59d2 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js @@ -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) {