diff --git a/services/web/frontend/js/features/source-editor/components/table-generator/table.tsx b/services/web/frontend/js/features/source-editor/components/table-generator/table.tsx index 25c5a7dbfe..20e1193768 100644 --- a/services/web/frontend/js/features/source-editor/components/table-generator/table.tsx +++ b/services/web/frontend/js/features/source-editor/components/table-generator/table.tsx @@ -145,7 +145,7 @@ export const Table: FC = () => { const onKeyDown: KeyboardEventHandler = useCallback( event => { const commandKey = isMac ? event.metaKey : event.ctrlKey - if (event.code === 'Enter' && !event.shiftKey) { + if (event.code === 'Enter' && !event.shiftKey && !commandKey) { event.preventDefault() event.stopPropagation() if (!selection) { diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-table-generator.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-table-generator.spec.tsx index 3e3ea9f654..31a20651e7 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-table-generator.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-table-generator.spec.tsx @@ -109,6 +109,7 @@ describe(' Table editor', function () { cy.interceptEvents() cy.interceptSpelling() cy.interceptMathJax() + cy.interceptCompile('compile', Number.MAX_SAFE_INTEGER) window.metaAttributesCache.set('ol-preventCompileOnLoad', true) window.metaAttributesCache.set('ol-splitTestVariants', { 'table-generator': 'enabled', @@ -637,5 +638,23 @@ cell 3 & cell 4 \\\\ cy.get('@cell-3').should('have.class', 'selected') cy.get('@cell-4').should('have.class', 'selected') }) + + it('Allow compilation shortcuts to work', function () { + mountEditor(` +\\begin{tabular}{cc } +cell 1 & cell 2\\\\ +cell 3 & cell 4 \\\\ +\\end{tabular}`) + cy.get('.table-generator-cell').eq(0).as('cell-1').click() + cy.get('@cell-1').type('{ctrl}{enter}') + cy.wait('@compile') + cy.get('@cell-1').type('foo{ctrl}{enter}') + cy.wait('@compile') + cy.get('@cell-1').type('{esc}') + cy.get('@cell-1').type('{ctrl}{s}') + cy.wait('@compile') + cy.get('@cell-1').type('foo{ctrl}{s}') + cy.wait('@compile') + }) }) })