mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
Extract view mode shortcut code into hook (#688)
This commit is contained in:
parent
c6d2aa76ca
commit
4603e3988a
2 changed files with 13 additions and 8 deletions
|
@ -16,7 +16,7 @@ import { EditorPane } from './editor-pane/editor-pane'
|
|||
import { editorTestContent } from './editorTestContent'
|
||||
import { useFirstDraw } from './hooks/useFirstDraw'
|
||||
import { DualScrollState, ScrollState } from './scroll/scroll-props'
|
||||
import { shortcutHandler } from './shortcut/shortcut'
|
||||
import { useViewModeShortcuts } from './hooks/useViewModeShortcuts'
|
||||
import { Splitter } from './splitter/splitter'
|
||||
import { YAMLMetaData } from './yaml-metadata/yaml-metadata'
|
||||
|
||||
|
@ -75,12 +75,7 @@ export const Editor: React.FC = () => {
|
|||
}
|
||||
}, [markdownContent, setMarkdownContent])
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('keydown', shortcutHandler, false)
|
||||
return () => {
|
||||
document.removeEventListener('keydown', shortcutHandler, false)
|
||||
}
|
||||
}, [])
|
||||
useViewModeShortcuts()
|
||||
|
||||
const isFirstDraw = useFirstDraw()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue