mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
[web] Move ARS Write and Cite behind separate feature flag (#20631)
* [web] Move ARS Write and Cite behind separate feature flag * [web] Use isSplitTestEnabled function * [web] Only load Write and Cite if project has ARS access * [web] Enable Write and Cite ARS by default * [web] Fix condition for loading write and cite ref sources * [web] Remove references settings button in free projects GitOrigin-RevId: c4f3b7c60da9864409c788dcf34bdc77347441a8
This commit is contained in:
parent
7daebe2f42
commit
aba4694377
3 changed files with 10 additions and 4 deletions
|
@ -339,6 +339,7 @@ const _ProjectController = {
|
|||
!anonymous && 'writefull-oauth-promotion',
|
||||
'ieee-stylesheet',
|
||||
'write-and-cite',
|
||||
'write-and-cite-ars',
|
||||
'default-visual-for-beginners',
|
||||
'spell-check-client',
|
||||
].filter(Boolean)
|
||||
|
|
|
@ -54,9 +54,10 @@ import { ranges } from './ranges'
|
|||
import { trackDetachedComments } from './track-detached-comments'
|
||||
import { addComment } from './add-comment'
|
||||
|
||||
const moduleExtensions: Array<() => Extension> = importOverleafModules(
|
||||
'sourceEditorExtensions'
|
||||
).map((item: { import: { extension: Extension } }) => item.import.extension)
|
||||
const moduleExtensions: Array<(options: Record<string, any>) => Extension> =
|
||||
importOverleafModules('sourceEditorExtensions').map(
|
||||
(item: { import: { extension: Extension } }) => item.import.extension
|
||||
)
|
||||
|
||||
export const createExtensions = (options: Record<string, any>): Extension[] => [
|
||||
lineNumbers(),
|
||||
|
@ -145,7 +146,7 @@ export const createExtensions = (options: Record<string, any>): Extension[] => [
|
|||
// Send exceptions to Sentry
|
||||
EditorView.exceptionSink.of(options.handleException),
|
||||
// CodeMirror extensions provided by modules
|
||||
moduleExtensions.map(extension => extension()),
|
||||
moduleExtensions.map(extension => extension(options)),
|
||||
thirdPartyExtensions(),
|
||||
effectListeners(),
|
||||
geometryChangeEvent(),
|
||||
|
|
|
@ -111,6 +111,7 @@ function useCodeMirrorScope(view: EditorView) {
|
|||
const [spellCheckLanguage] = useScopeValue<string>(
|
||||
'project.spellCheckLanguage'
|
||||
)
|
||||
const [projectFeatures] = useScopeValue<boolean>('project.features')
|
||||
|
||||
const hunspellManager = useHunspell(spellCheckLanguage)
|
||||
|
||||
|
@ -228,6 +229,8 @@ function useCodeMirrorScope(view: EditorView) {
|
|||
view.dispatch(setSpellCheckLanguage(spellingRef.current))
|
||||
}, [view, spellCheckLanguage, hunspellManager])
|
||||
|
||||
const projectFeaturesRef = useRef(projectFeatures)
|
||||
|
||||
// listen to doc:after-opened, and focus the editor if it's not a new doc
|
||||
useEffect(() => {
|
||||
const listener: EventListener = event => {
|
||||
|
@ -326,6 +329,7 @@ function useCodeMirrorScope(view: EditorView) {
|
|||
phrases: phrasesRef.current,
|
||||
spelling: spellingRef.current,
|
||||
visual: visualRef.current,
|
||||
projectFeatures: projectFeaturesRef.current,
|
||||
changeManager: createChangeManager(view, currentDoc),
|
||||
handleError,
|
||||
handleException,
|
||||
|
|
Loading…
Reference in a new issue