From d1fcb9ac7401d575bdb4bc64b25b29b8e042c40f Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Wed, 14 Jul 2021 12:17:18 +0000 Subject: [PATCH] [FIX] web_editor: prevent double insert link on paste When pasting text containing url, the url was pasted twice. One being simple text and the other one being a link. Task ID: 2602785 closes odoo/odoo#73709 Signed-off-by: Antoine Guenet --- addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index baa653d8752..e3e3c49d92f 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -2148,8 +2148,8 @@ export class OdooEditor extends EventTarget { }, ]; - this.execCommand('insertText', splitAroundUrl[i]); if (['jpg', 'jpeg', 'png', 'gif'].includes(urlFileExtention)) { + this.execCommand('insertText', splitAroundUrl[i]); this.commandBar.open({ commands: [ { @@ -2171,6 +2171,7 @@ export class OdooEditor extends EventTarget { ].concat(baseEmbedCommand), }); } else if (youtubeUrl) { + this.execCommand('insertText', splitAroundUrl[i]); this.commandBar.open({ commands: [ {