mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 23:24:46 -04:00
Add application state hook (#1308)
* Add application state hook Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Add docs Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4720f2d36b
commit
829cc2fe48
47 changed files with 149 additions and 195 deletions
|
@ -7,12 +7,11 @@
|
|||
import React from 'react'
|
||||
import { ToggleButton, ToggleButtonGroup } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { ApplicationState } from '../../../../redux'
|
||||
import { setEditorSyncScroll } from '../../../../redux/editor/methods'
|
||||
import { ReactComponent as DisabledScrollIcon } from './disabledScroll.svg'
|
||||
import { ReactComponent as EnabledScrollIcon } from './enabledScroll.svg'
|
||||
import './sync-scroll-buttons.scss'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
enum SyncScrollState {
|
||||
SYNCED,
|
||||
|
@ -20,7 +19,7 @@ enum SyncScrollState {
|
|||
}
|
||||
|
||||
export const SyncScrollButtons: React.FC = () => {
|
||||
const syncScrollEnabled = useSelector((state: ApplicationState) => state.editorConfig.syncScroll)
|
||||
const syncScrollEnabled = useApplicationState((state) => state.editorConfig.syncScroll)
|
||||
? SyncScrollState.SYNCED
|
||||
: SyncScrollState.UNSYNCED
|
||||
const { t } = useTranslation()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue