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 dcbaf3bf8d9..d96b274477b 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 @@ -4700,6 +4700,7 @@ export class OdooEditor extends EventTarget { if ( selection && selection.anchorNode && + isHtmlContentSupported(selection.anchorNode) && !closestElement(selection.anchorNode).closest('a') && selection.anchorNode.nodeType === Node.TEXT_NODE ) { @@ -4784,7 +4785,10 @@ export class OdooEditor extends EventTarget { link.remove(); setSelection(...start, ...start, false); } - if (odooEditorHtml && targetSupportsHtmlContent) { + if (!targetSupportsHtmlContent) { + const text = ev.clipboardData.getData("text/plain"); + this._applyCommand("insert", text); + } else if (odooEditorHtml) { const fragment = parseHTML(this.document, odooEditorHtml); // Instantiate DOMPurify with the correct window. this.DOMPurify ??= DOMPurify(this.document.defaultView); @@ -4792,7 +4796,7 @@ export class OdooEditor extends EventTarget { if (fragment.hasChildNodes()) { this._applyCommand('insert', fragment); } - } else if ((files.length || clipboardHtml) && targetSupportsHtmlContent) { + } else if (files.length || clipboardHtml) { const clipboardElem = this._prepareClipboardData(clipboardHtml); // When copy pasting a table from the outside, a picture of the // table can be included in the clipboard as an image file. In that