mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 22:43:53 +00:00
[visual] Configure italic markup to be placed inside the pasted styled element (#14918)
GitOrigin-RevId: b7038381583a6828a9ab24f6d9608c10cf3e370a
This commit is contained in:
parent
0be7c32bed
commit
9313a1fbd1
2 changed files with 22 additions and 0 deletions
|
@ -560,6 +560,7 @@ const selectors = [
|
|||
element.style.fontStyle === 'italic' && hasContent(element),
|
||||
start: () => '\\textit{',
|
||||
end: () => '}',
|
||||
inside: true,
|
||||
}),
|
||||
createSelector({
|
||||
selector: 'em',
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue