mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
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:
parent
4775622f19
commit
3bc9708871
6 changed files with 40 additions and 35 deletions
|
@ -445,35 +445,6 @@
|
||||||
"errorAddingAlias": "The chosen alias can not be added to this note",
|
"errorAddingAlias": "The chosen alias can not be added to this note",
|
||||||
"errorRemovingAlias": "There was an error removing the alias",
|
"errorRemovingAlias": "There was an error removing the alias",
|
||||||
"errorMakingPrimary": "There was an error marking the alias as primary"
|
"errorMakingPrimary": "There was an error marking the alias as primary"
|
||||||
},
|
|
||||||
"preferences": {
|
|
||||||
"title": "Preferences",
|
|
||||||
"theme": {
|
|
||||||
"label": "Editor theme",
|
|
||||||
"one-dark": "Dark",
|
|
||||||
"neat": "Light"
|
|
||||||
},
|
|
||||||
"keyMap": {
|
|
||||||
"label": "Keymap",
|
|
||||||
"sublime": "Sublime",
|
|
||||||
"emacs": "Emacs",
|
|
||||||
"vim": "Vim"
|
|
||||||
},
|
|
||||||
"indentWithTabs": {
|
|
||||||
"label": "Tab character",
|
|
||||||
"on": "Tabs",
|
|
||||||
"off": "Spaces"
|
|
||||||
},
|
|
||||||
"indentUnit": "Number of spaces per tab",
|
|
||||||
"spellcheck": {
|
|
||||||
"label": "Spell checking"
|
|
||||||
},
|
|
||||||
"ligatures": {
|
|
||||||
"label": "Show ligatures"
|
|
||||||
},
|
|
||||||
"smartPaste": {
|
|
||||||
"label": "Auto format pasted content"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"embeddings": {
|
"embeddings": {
|
||||||
|
@ -637,6 +608,10 @@
|
||||||
"lineWrapping": {
|
"lineWrapping": {
|
||||||
"label": "Line Wrapping",
|
"label": "Line Wrapping",
|
||||||
"help": "Breaks long lines so they're visible without scrolling."
|
"help": "Breaks long lines so they're visible without scrolling."
|
||||||
|
},
|
||||||
|
"spellCheck":{
|
||||||
|
"label": "Spell checking",
|
||||||
|
"help": "Enables browser spell checking."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"global": {
|
"global": {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { SyncScrollSettingButtonGroup } from './sync-scroll-setting-button-group
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ListGroup } from 'react-bootstrap'
|
import { ListGroup } from 'react-bootstrap'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { SpellcheckSettingButtonGroup } from './spellcheck-setting-button-group'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the editor specific settings.
|
* Shows the editor specific settings.
|
||||||
|
@ -32,6 +33,9 @@ export const EditorSettingsTabContent: React.FC = () => {
|
||||||
<SettingLine i18nKey={'editor.lineWrapping'}>
|
<SettingLine i18nKey={'editor.lineWrapping'}>
|
||||||
<LineWrappingSettingButtonGroup />
|
<LineWrappingSettingButtonGroup />
|
||||||
</SettingLine>
|
</SettingLine>
|
||||||
|
<SettingLine i18nKey={'editor.spellCheck'}>
|
||||||
|
<SpellcheckSettingButtonGroup />
|
||||||
|
</SettingLine>
|
||||||
</ListGroup>
|
</ListGroup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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} />
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,8 @@ import type {
|
||||||
SetEditorLigaturesAction,
|
SetEditorLigaturesAction,
|
||||||
SetEditorLineWrappingAction,
|
SetEditorLineWrappingAction,
|
||||||
SetEditorSmartPasteAction,
|
SetEditorSmartPasteAction,
|
||||||
SetEditorSyncScrollAction
|
SetEditorSyncScrollAction,
|
||||||
|
SetEditorSpellCheckAction
|
||||||
} from './types'
|
} from './types'
|
||||||
import { EditorConfigActionType } from './types'
|
import { EditorConfigActionType } from './types'
|
||||||
|
|
||||||
|
@ -45,6 +46,14 @@ export const setEditorSmartPaste = (smartPaste: boolean): void => {
|
||||||
store.dispatch(action)
|
store.dispatch(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const setEditorSpellCheck = (spellCheck: boolean): void => {
|
||||||
|
const action: SetEditorSpellCheckAction = {
|
||||||
|
type: EditorConfigActionType.SET_SPELL_CHECK,
|
||||||
|
spellCheck
|
||||||
|
}
|
||||||
|
store.dispatch(action)
|
||||||
|
}
|
||||||
|
|
||||||
export const loadFromLocalStorage = (): void => {
|
export const loadFromLocalStorage = (): void => {
|
||||||
const action: LoadFromLocalStorageAction = {
|
const action: LoadFromLocalStorageAction = {
|
||||||
type: EditorConfigActionType.LOAD_FROM_LOCAL_STORAGE
|
type: EditorConfigActionType.LOAD_FROM_LOCAL_STORAGE
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const initialState: EditorConfig = {
|
||||||
ligatures: true,
|
ligatures: true,
|
||||||
syncScroll: true,
|
syncScroll: true,
|
||||||
smartPaste: true,
|
smartPaste: true,
|
||||||
spellCheck: false,
|
spellCheck: true,
|
||||||
lineWrapping: true
|
lineWrapping: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@ export type EditorConfigActions =
|
||||||
| SetEditorLigaturesAction
|
| SetEditorLigaturesAction
|
||||||
| SetEditorSmartPasteAction
|
| SetEditorSmartPasteAction
|
||||||
| SetEditorLineWrappingAction
|
| SetEditorLineWrappingAction
|
||||||
| SetSpellCheckAction
|
| SetEditorSpellCheckAction
|
||||||
| LoadFromLocalStorageAction
|
| LoadFromLocalStorageAction
|
||||||
|
|
||||||
export interface LoadFromLocalStorageAction extends Action<EditorConfigActionType> {
|
export interface LoadFromLocalStorageAction extends Action<EditorConfigActionType> {
|
||||||
|
@ -55,7 +55,7 @@ export interface SetEditorSmartPasteAction extends Action<EditorConfigActionType
|
||||||
smartPaste: boolean
|
smartPaste: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SetSpellCheckAction extends Action<EditorConfigActionType> {
|
export interface SetEditorSpellCheckAction extends Action<EditorConfigActionType> {
|
||||||
type: EditorConfigActionType.SET_SPELL_CHECK
|
type: EditorConfigActionType.SET_SPELL_CHECK
|
||||||
spellCheck: boolean
|
spellCheck: boolean
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue