mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
Disable spell check setting when doc is read-only (#21253)
GitOrigin-RevId: 1053fefd953d4f60b1c2aef4170f99c6885c265d
This commit is contained in:
parent
baed6cc291
commit
98bf2ac055
3 changed files with 9 additions and 4 deletions
|
@ -5,6 +5,7 @@ import { useProjectSettingsContext } from '../../context/project-settings-contex
|
|||
import SettingsMenuSelect from './settings-menu-select'
|
||||
import type { Optgroup } from './settings-menu-select'
|
||||
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
|
||||
export default function SettingsSpellCheckLanguage() {
|
||||
const { t } = useTranslation()
|
||||
|
@ -15,6 +16,7 @@ export default function SettingsSpellCheckLanguage() {
|
|||
|
||||
const { spellCheckLanguage, setSpellCheckLanguage } =
|
||||
useProjectSettingsContext()
|
||||
const { permissionsLevel } = useEditorContext()
|
||||
|
||||
const optgroup: Optgroup = useMemo(() => {
|
||||
const options = (languages ?? []).filter(language => {
|
||||
|
@ -48,6 +50,7 @@ export default function SettingsSpellCheckLanguage() {
|
|||
optgroup={optgroup}
|
||||
label={t('spell_check')}
|
||||
name="spellCheckLanguage"
|
||||
disabled={permissionsLevel === 'readOnly'}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ export class SpellChecker {
|
|||
|
||||
destroy() {
|
||||
this._clearPendingSpellCheck()
|
||||
// this.hunspellManager?.destroy()
|
||||
}
|
||||
|
||||
_abortRequest() {
|
||||
|
|
|
@ -108,9 +108,12 @@ function useCodeMirrorScope(view: EditorView) {
|
|||
'onlineUserCursorHighlights'
|
||||
)
|
||||
|
||||
const [spellCheckLanguage] = useScopeValue<string>(
|
||||
'project.spellCheckLanguage'
|
||||
)
|
||||
let [spellCheckLanguage] = useScopeValue<string>('project.spellCheckLanguage')
|
||||
// spell check is off when read-only
|
||||
if (!permissions.write) {
|
||||
spellCheckLanguage = ''
|
||||
}
|
||||
|
||||
const [projectFeatures] =
|
||||
useScopeValue<Record<string, boolean | string | number | undefined>>(
|
||||
'project.features'
|
||||
|
|
Loading…
Reference in a new issue