Allow Ctrl+Enter to start a compile while editing a table cell on macOS (#14940)

GitOrigin-RevId: 513affff5af4af9dd12cdb1d730c978e6bdac303
This commit is contained in:
Alf Eaton 2023-09-27 11:53:57 +01:00 committed by Copybot
parent db76d1c316
commit 637788076a

View file

@ -18,6 +18,7 @@ import { useTableContext } from './contexts/table-context'
import { useCodeMirrorViewContext } from '../codemirror-editor'
import { undo, redo } from '@codemirror/commands'
import { ChangeSpec } from '@codemirror/state'
import { startCompileKeypress } from '@/features/pdf-preview/hooks/use-compile-triggers'
type NavigationKey =
| 'ArrowRight'
@ -144,8 +145,11 @@ export const Table: FC = () => {
const onKeyDown: KeyboardEventHandler = useCallback(
event => {
if (startCompileKeypress(event)) {
return
}
const commandKey = isMac ? event.metaKey : event.ctrlKey
if (event.code === 'Enter' && !event.shiftKey && !commandKey) {
if (event.code === 'Enter' && !event.shiftKey) {
event.preventDefault()
event.stopPropagation()
if (!selection) {