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 0098ded098c..48f7dcd6079 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 @@ -4638,7 +4638,12 @@ export class OdooEditor extends EventTarget { } }); } else { - this._applyCommand('insert', clipboardElem); + if (closestElement(sel.anchorNode, 'a')) { + this._applyCommand('insert', clipboardElem.textContent); + } + else { + this._applyCommand('insert', clipboardElem); + } } } else { const text = ev.clipboardData.getData('text/plain'); diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/copyPaste.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/copyPaste.test.js index 5d5a3c29727..b321bd5f132 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/copyPaste.test.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/copyPaste.test.js @@ -1548,6 +1548,15 @@ describe('Paste', () => { contentAfter: `
${url} abc ${videoUrl} def ${imgUrl}[]
`, }); }); + it('should paste plain text inside non empty link', async () => { + await testEditor(BasicEditor, { + contentBefore: '', + stepFunction: async editor => { + await pasteHtml(editor, '123'); + }, + contentAfter: '', + }); + }); }); describe('range not collapsed', async () => { it('should paste and transform an URL in a p', async () => {