[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) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-08-03 09:24:39 +02:00
parent 3bceb9159b
commit 52d8f8a253
@@ -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);