[visual] Configure italic markup to be placed inside the pasted styled element (#14918)

GitOrigin-RevId: b7038381583a6828a9ab24f6d9608c10cf3e370a
This commit is contained in:
Alf Eaton 2023-09-22 11:53:58 +01:00 committed by Copybot
parent 0be7c32bed
commit 9313a1fbd1
2 changed files with 22 additions and 0 deletions

View file

@ -560,6 +560,7 @@ const selectors = [
element.style.fontStyle === 'italic' && hasContent(element),
start: () => '\\textit{',
end: () => '}',
inside: true,
}),
createSelector({
selector: 'em',

View file

@ -278,6 +278,27 @@ describe('<CodeMirrorEditor/> 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 =
'<table><tbody><tr><td style="font-weight:bold">foo</td><td style="font-style:italic">bar</td><td style="font-style:italic;font-weight:bold">baz</td></tr></tbody></table>'
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()