move useHotkey for undo/redo into App
This commit is contained in:
11
src/App.tsx
11
src/App.tsx
@ -29,6 +29,7 @@ import {
|
||||
codeManager,
|
||||
kclManager,
|
||||
settingsActor,
|
||||
editorManager,
|
||||
} from '@src/lib/singletons'
|
||||
import { maybeWriteToDisk } from '@src/lib/telemetry'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
@ -94,6 +95,16 @@ export function App() {
|
||||
useHotkeys('backspace', (e) => {
|
||||
e.preventDefault()
|
||||
})
|
||||
// Since these already exist in the editor, we don't need to define them
|
||||
// with the wrapper.
|
||||
useHotkeys('mod+z', (e) => {
|
||||
e.preventDefault()
|
||||
editorManager.undo()
|
||||
})
|
||||
useHotkeys('mod+shift+z', (e) => {
|
||||
e.preventDefault()
|
||||
editorManager.redo()
|
||||
})
|
||||
useHotkeyWrapper(
|
||||
[isDesktop() ? 'mod + ,' : 'shift + mod + ,'],
|
||||
() => navigate(filePath + PATHS.SETTINGS),
|
||||
|
@ -75,17 +75,6 @@ export const KclEditorPane = () => {
|
||||
: context.app.theme.current
|
||||
const { copilotLSP, kclLSP } = useLspContext()
|
||||
|
||||
// Since these already exist in the editor, we don't need to define them
|
||||
// with the wrapper.
|
||||
useHotkeys('mod+z', (e) => {
|
||||
e.preventDefault()
|
||||
editorManager.undo()
|
||||
})
|
||||
useHotkeys('mod+shift+z', (e) => {
|
||||
e.preventDefault()
|
||||
editorManager.redo()
|
||||
})
|
||||
|
||||
// When this component unmounts, we need to tell the machine that the editor
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
|
Reference in New Issue
Block a user