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 b75941c0a4c..86d268687cd 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 @@ -3277,7 +3277,7 @@ export class OdooEditor extends EventTarget { } } } else if (splitAroundUrl[i] !== '') { - const textFragments = splitAroundUrl[i].split('\n'); + const textFragments = splitAroundUrl[i].split(/\r?\n/); let textIndex = 1; for (const textFragment of textFragments) { this.execCommand('insertText', textFragment); 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 71ba3e39669..fb0f90c5823 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 @@ -157,6 +157,26 @@ describe('Copy and paste', () => { contentAfter: '
abx[]cd
', }); }); + // TODO: We might want to have it consider \n as paragraph breaks + // instead of linebreaks but that would be an opinionated choice. + it('should paste text and understand \n newlines', async () => { + await testEditor(BasicEditor, { + contentBefore: '[]
a
b
c
d[]
[]
a
b
c
d[]