From f7356f6a196e6d2afff3cae2d2272e962093f3cc Mon Sep 17 00:00:00 2001 From: dhba-odoo Date: Mon, 5 Sep 2022 08:42:54 +0000 Subject: [PATCH] [FIX] web_editor: mailto url link tools Before this commit: When trying to edit a link with mailto, there is an "https://" added and preventing the link to work successfully After this commit: The mailto part of the link is correctly kept as is and the link works. Task-2961012 Task-2977682 closes odoo/odoo#104064 X-original-commit: a22d6d1859a8f97c3cccdba755392cd13d7eb866 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/widgets/link.js | 5 ++++- 1 file changed, 4 insertions(+), 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 049f01bbe46..4caf3a3619b 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js @@ -299,7 +299,10 @@ const Link = Widget.extend({ (type && size ? (' btn-' + size) : ''); var isNewWindow = this._isNewWindow(url); var doStripDomain = this._doStripDomain(); - if (url.indexOf('@') >= 0 && url.indexOf('mailto:') < 0 && !url.match(/^http[s]?/i)) { + if ( + url.indexOf('@') >= 0 && url.indexOf('mailto:') < 0 && !url.match(/^http[s]?/i) || + this._link && this._link.href.includes('mailto:') && !url.includes('mailto:') + ) { url = ('mailto:' + url); } else if (url.indexOf(location.origin) === 0 && doStripDomain) { url = url.slice(location.origin.length);