diff --git a/services/web/frontend/js/features/editor-left-menu/components/settings/settings-spell-check-language.tsx b/services/web/frontend/js/features/editor-left-menu/components/settings/settings-spell-check-language.tsx index 0d52ab4b49..64430f413c 100644 --- a/services/web/frontend/js/features/editor-left-menu/components/settings/settings-spell-check-language.tsx +++ b/services/web/frontend/js/features/editor-left-menu/components/settings/settings-spell-check-language.tsx @@ -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'} /> ) } diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts b/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts index 72c83dc969..8bbeafca84 100644 --- a/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts +++ b/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts @@ -62,7 +62,6 @@ export class SpellChecker { destroy() { this._clearPendingSpellCheck() - // this.hunspellManager?.destroy() } _abortRequest() { diff --git a/services/web/frontend/js/features/source-editor/hooks/use-codemirror-scope.ts b/services/web/frontend/js/features/source-editor/hooks/use-codemirror-scope.ts index b28d6885d8..d44be37b3b 100644 --- a/services/web/frontend/js/features/source-editor/hooks/use-codemirror-scope.ts +++ b/services/web/frontend/js/features/source-editor/hooks/use-codemirror-scope.ts @@ -108,9 +108,12 @@ function useCodeMirrorScope(view: EditorView) { 'onlineUserCursorHighlights' ) - const [spellCheckLanguage] = useScopeValue( - 'project.spellCheckLanguage' - ) + let [spellCheckLanguage] = useScopeValue('project.spellCheckLanguage') + // spell check is off when read-only + if (!permissions.write) { + spellCheckLanguage = '' + } + const [projectFeatures] = useScopeValue>( 'project.features'