[cm6] support \emph and \textbf in maketitle (#13703)

* [cm6] support \textbf in maketitle

* support for emph

* added support for \\textbf

* fix overlapping ignored ranges

* fix overlapping fn, added test

* multiple maketitle cases in the same test

* prettier

* simplify from calculation

* added test cases from #13736

GitOrigin-RevId: 00dcf15d6d62903ae30b387a16929e68dde8ca1b
This commit is contained in:
Domagoj Kriskovic
2023-07-17 11:02:11 +00:00
committed by Copybot
parent fdeb36c2c2
commit 8ab6239a24
2 changed files with 66 additions and 13 deletions
@@ -360,6 +360,39 @@ describe('<CodeMirrorEditor/> in Visual mode', function () {
cy.get('.ol-cm-maketitle')
cy.get('.ol-cm-title').should('contain.html', 'Document title<br>with')
cy.get('.ol-cm-author').should('have.text', 'Author')
cy.get('.ol-cm-preamble-widget').click()
const deleteLine =
'{command}{leftArrow}{shift}{command}{rightArrow}{backspace}'
cy.get('@second-line').type(deleteLine)
cy.get('@second-line').type(
'\\title{{}formatted with \\textit{{}italic} \\textbf{{}bold} \\emph{{}emph}}'
)
cy.get('.ol-cm-title').should(
'contain.html',
'formatted with <i>italic</i> <b>bold</b> <em>emph</em>'
)
cy.get('@second-line').type(deleteLine)
cy.get('@second-line').type(
'\\title{{}title\\\\ \\textbf{{}\\textit{{}\\emph{{}formated}}} \\textit{{}only italic}}'
)
cy.get('.ol-cm-title').should(
'contain.html',
'title<br> <b><i><em>formated</em></i></b> <i>only italic</i>'
)
cy.get('@second-line').type(deleteLine)
cy.get('@second-line').type('\\title{{}Title with \\& ampersands}')
cy.get('.ol-cm-title').should(
'contain.html',
'Title with \\&amp; ampersands'
)
cy.get('@second-line').type(deleteLine)
cy.get('@second-line').type('\\title{{}My \\LaTeX{{}} document}')
cy.get('.ol-cm-title').should('contain.html', 'My \\LaTeX{} document')
})
it('decorates footnotes', function () {