fix(settings): re-add spellcheck setting

This was included in the old editor preferences dialog,
which got removed altogether with the document-bar.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2023-10-13 18:35:24 +02:00
parent 4775622f19
commit 3bc9708871
6 changed files with 40 additions and 35 deletions

View file

@ -11,6 +11,7 @@ import { SyncScrollSettingButtonGroup } from './sync-scroll-setting-button-group
import React from 'react'
import { ListGroup } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { SpellcheckSettingButtonGroup } from './spellcheck-setting-button-group'
/**
* Shows the editor specific settings.
@ -32,6 +33,9 @@ export const EditorSettingsTabContent: React.FC = () => {
<SettingLine i18nKey={'editor.lineWrapping'}>
<LineWrappingSettingButtonGroup />
</SettingLine>
<SettingLine i18nKey={'editor.spellCheck'}>
<SpellcheckSettingButtonGroup />
</SettingLine>
</ListGroup>
)
}

View file

@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplicationState } from '../../../../hooks/common/use-application-state'
import { setEditorSpellCheck } from '../../../../redux/editor/methods'
import { OnOffButtonGroup } from '../utils/on-off-button-group'
import React from 'react'
/**
* Allows to change whether spellchecking is enabled or not in the editor.
*/
export const SpellcheckSettingButtonGroup: React.FC = () => {
const enabled = useApplicationState((state) => state.editorConfig.spellCheck)
return <OnOffButtonGroup value={enabled} onSelect={setEditorSpellCheck} />
}