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