From 52d8f8a2539847fbcd3cea3d05a6606b338e45fa Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 2 Aug 2022 12:17:20 +0000 Subject: [PATCH] [FIX] web_editor: try to paste html before files Before this commit, when trying to paste into the Odoo editor, if file and html was in the clipboard, the file got precedence and were added instead of html. task-2941679 closes odoo/odoo#97359 X-original-commit: 0af0927f48f213d835a7d4a8396fc6376476e220 Signed-off-by: David Monjoie (dmo) --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index b2f9558a8e6..4ee545cf2e6 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -3122,10 +3122,10 @@ export class OdooEditor extends EventTarget { const sel = this.document.getSelection(); const files = getImageFiles(ev.clipboardData); const clipboardHtml = ev.clipboardData.getData('text/html'); - if (files.length) { - this.addImagesFiles(files); - } else if (clipboardHtml) { + if (clipboardHtml) { this.execCommand('insertHTML', this._prepareClipboardData(clipboardHtml)); + } else if (files.length) { + this.addImagesFiles(files); } else { const text = ev.clipboardData.getData('text/plain'); const splitAroundUrl = text.split(URL_REGEX);