From 8f7d64e2def589999c1c996e0ada13d739fa6f2a Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Fri, 4 Mar 2022 09:18:19 +0000 Subject: [PATCH] [FIX] web_editor: make sure all external links open in new tab This collects all external links on clean the editor so as to make them open in a new tab. task-2740021 closes odoo/odoo#86289 X-original-commit: 8d2c8b4bad7a7aaa313aad361b48d77823841dbe Signed-off-by: David Monjoie (dmo) --- .../web_editor/static/src/js/backend/field_html.js | 12 ++++++++++++ addons/web_editor/static/tests/field_html_tests.js | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js index 02bdbee2125..dec2d9b7ed7 100644 --- a/addons/web_editor/static/src/js/backend/field_html.js +++ b/addons/web_editor/static/src/js/backend/field_html.js @@ -307,6 +307,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { var def = new Promise(function (resolve) { resolver = resolve; }); + const externalLinkSelector = `a:not([href^="${location.origin}"]):not([href^="/"])`; if (this.nodeOptions.cssReadonly) { this.$iframe = $('