mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Add decorations for textmd and textsf (#13716)
GitOrigin-RevId: c5bedf2260c4e075e458ac38f90e5746dccdde81
This commit is contained in:
+8
-3
@@ -849,9 +849,14 @@ export const atomicDecorations = (options: Options) => {
|
|||||||
)
|
)
|
||||||
} else if (
|
} else if (
|
||||||
// markup that can't be toggled using toolbar buttons/keyboard shortcuts
|
// markup that can't be toggled using toolbar buttons/keyboard shortcuts
|
||||||
['\\textsc', '\\texttt', '\\sout', '\\emph'].includes(
|
[
|
||||||
commandName
|
'\\textsc',
|
||||||
)
|
'\\texttt',
|
||||||
|
'\\textmd',
|
||||||
|
'\\textsf',
|
||||||
|
'\\sout',
|
||||||
|
'\\emph',
|
||||||
|
].includes(commandName)
|
||||||
) {
|
) {
|
||||||
if (shouldDecorate(state, nodeRef)) {
|
if (shouldDecorate(state, nodeRef)) {
|
||||||
decorations.push(
|
decorations.push(
|
||||||
|
|||||||
@@ -220,6 +220,12 @@ export const visualTheme = EditorView.theme({
|
|||||||
'.ol-cm-command-texttt': {
|
'.ol-cm-command-texttt': {
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'monospace',
|
||||||
},
|
},
|
||||||
|
'.ol-cm-command-textmd, .ol-cm-command-textmd > .ol-cm-command-textbf': {
|
||||||
|
fontWeight: 'normal',
|
||||||
|
},
|
||||||
|
'.ol-cm-command-textsf': {
|
||||||
|
fontFamily: 'var(--source-font-family)',
|
||||||
|
},
|
||||||
'.ol-cm-command-underline': {
|
'.ol-cm-command-underline': {
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
},
|
},
|
||||||
|
|||||||
+18
-12
@@ -149,18 +149,24 @@ describe('<CodeMirrorEditor/> in Visual mode', function () {
|
|||||||
cy.get('@first-line').find(`.ol-cm-heading.ol-cm-command-${command}`)
|
cy.get('@first-line').find(`.ol-cm-heading.ol-cm-command-${command}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
forEach(['textsc', 'texttt', 'sout', 'emph', 'url', 'caption']).it(
|
forEach([
|
||||||
'handles \\%s text',
|
'textsc',
|
||||||
function (command) {
|
'texttt',
|
||||||
cy.get('@first-line').type(`\\${command}{`)
|
'textmd',
|
||||||
cy.get('@first-line').should('have.text', `\\${command}{}`)
|
'textsf',
|
||||||
cy.get('@first-line').type('{rightArrow} ')
|
'sout',
|
||||||
cy.get('@first-line').should('have.text', `\\${command}{} `)
|
'emph',
|
||||||
cy.get('@first-line').type('{Backspace}{leftArrow}test text{rightArrow} ')
|
'url',
|
||||||
cy.get('@first-line').should('have.text', 'test text ')
|
'caption',
|
||||||
cy.get('@first-line').find(`.ol-cm-command-${command}`)
|
]).it('handles \\%s text', function (command) {
|
||||||
}
|
cy.get('@first-line').type(`\\${command}{`)
|
||||||
)
|
cy.get('@first-line').should('have.text', `\\${command}{}`)
|
||||||
|
cy.get('@first-line').type('{rightArrow} ')
|
||||||
|
cy.get('@first-line').should('have.text', `\\${command}{} `)
|
||||||
|
cy.get('@first-line').type('{Backspace}{leftArrow}test text{rightArrow} ')
|
||||||
|
cy.get('@first-line').should('have.text', 'test text ')
|
||||||
|
cy.get('@first-line').find(`.ol-cm-command-${command}`)
|
||||||
|
})
|
||||||
|
|
||||||
it('handles \\verb text', function () {
|
it('handles \\verb text', function () {
|
||||||
cy.get('@first-line').type(`\\verb|`)
|
cy.get('@first-line').type(`\\verb|`)
|
||||||
|
|||||||
Reference in New Issue
Block a user