mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Move project context out of scope value store (#26615)
* Refactor project context to not use scope store * Fix Cypress tests for project context changes * Fix frontend React Testing Library tests for project context changes * Remove redundant code * Fix some project types in tests * Remove unused import and fix a type * Throw an error if updating the project in the project context before joining the project * Fix some review panel tests * Remove unused imports GitOrigin-RevId: 2f0c928b651f387aa980c29aef7d1ba0649790a7
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useCallback, useEffect, useRef } from 'react'
|
||||
import { EditorState } from '@codemirror/state'
|
||||
import useScopeValue from '../../../shared/hooks/use-scope-value'
|
||||
import useScopeEventEmitter from '../../../shared/hooks/use-scope-event-emitter'
|
||||
import useEventListener from '../../../shared/hooks/use-event-listener'
|
||||
import useScopeEventListener from '../../../shared/hooks/use-scope-event-listener'
|
||||
@@ -55,6 +54,7 @@ import { GotoOffsetOptions } from '@/features/ide-react/context/editor-manager-c
|
||||
import { GotoLineOptions } from '@/features/ide-react/types/goto-line-options'
|
||||
import { useOnlineUsersContext } from '@/features/ide-react/context/online-users-context'
|
||||
import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context'
|
||||
import { useProjectContext } from '@/shared/context/project-context'
|
||||
import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
|
||||
import { useEditorPropertiesContext } from '@/features/ide-react/context/editor-properties-context'
|
||||
import { SearchQuery } from '@codemirror/search'
|
||||
@@ -92,17 +92,13 @@ function useCodeMirrorScope(view: EditorView) {
|
||||
|
||||
const { onlineUserCursorHighlights } = useOnlineUsersContext()
|
||||
|
||||
let [spellCheckLanguage] = useScopeValue<string>('project.spellCheckLanguage')
|
||||
const { project, features: projectFeatures } = useProjectContext()
|
||||
let spellCheckLanguage = project?.spellCheckLanguage || ''
|
||||
// spell check is off when read-only
|
||||
if (!permissions.write && !permissions.trackedWrite) {
|
||||
spellCheckLanguage = ''
|
||||
}
|
||||
|
||||
const [projectFeatures] =
|
||||
useScopeValue<Record<string, boolean | string | number | undefined>>(
|
||||
'project.features'
|
||||
)
|
||||
|
||||
const hunspellManager = useHunspell(spellCheckLanguage)
|
||||
|
||||
const { showVisual: visual, trackChanges } = useEditorPropertiesContext()
|
||||
|
||||
Reference in New Issue
Block a user