diff --git a/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts b/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts index 3de879304f..ff2c1e8ff7 100644 --- a/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts +++ b/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts @@ -560,6 +560,7 @@ const selectors = [ element.style.fontStyle === 'italic' && hasContent(element), start: () => '\\textit{', end: () => '}', + inside: true, }), createSelector({ selector: 'em', diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-paste-html.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-paste-html.spec.tsx index bf9c32afe3..0a3896b400 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-paste-html.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-paste-html.spec.tsx @@ -278,6 +278,27 @@ describe(' paste HTML in Visual mode', function () { ) }) + it('handles a pasted table with cell styles', function () { + window.metaAttributesCache.set('ol-splitTestVariants', { + 'paste-html': 'enabled', + 'table-generator': 'enabled', + }) + + mountEditor() + + const data = + '
foobarbaz
' + + const clipboardData = new DataTransfer() + clipboardData.setData('text/html', data) + cy.get('@content').trigger('paste', { clipboardData }) + + cy.get('@content').should('have.text', 'foobarbaz') + cy.findByText(/Sorry/).should('not.exist') + cy.get('td b').should('have.length', 2) + cy.get('td i').should('have.length', 2) + }) + it('handles a pasted table with a caption', function () { mountEditor()