overleaf/services/web/frontend/js/features/editor-left-menu/components/help-show-hotkeys.tsx
M Fahru 6dcc22642a Update "go to line" hotkey for cm6 and add new info text in hotkeys modal
* Update "go to line" hotkey for cm6 and add new info text in hotkeys modal

* Differentiate modal title between cm6 and ace hotkeys

* Update test to reflect change in hotkeys modal title

* Add test for hotkeys modal bottom text

* Update test on editor left menu hotkeys button to reflect change in hotkeys modal title

GitOrigin-RevId: 61bae16313ea7a37fa3b9441dbe5a93ab7823d01
2022-11-25 09:04:20 +00:00

35 lines
1.1 KiB
TypeScript

import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useProjectContext } from '../../../shared/context/project-context'
import HotkeysModal from '../../hotkeys-modal/components/hotkeys-modal'
import useScopeValue from '../../../shared/hooks/use-scope-value'
import LeftMenuButton from './left-menu-button'
export default function HelpShowHotkeys() {
const [showModal, setShowModal] = useState(false)
const [newSourceEditor] = useScopeValue('editor.newSourceEditor')
const { t } = useTranslation()
const { features } = useProjectContext()
const isMac = /Mac/.test(window.navigator?.platform)
return (
<>
<LeftMenuButton
onClick={() => setShowModal(true)}
icon={{
type: 'keyboard-o',
fw: true,
}}
>
{t('show_hotkeys')}
</LeftMenuButton>
<HotkeysModal
show={showModal}
handleHide={() => setShowModal(false)}
isMac={isMac}
trackChangesVisible={features?.trackChangesVisible}
newSourceEditor={newSourceEditor}
/>
</>
)
}