[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:
Mathias Jakobsen 2024-10-02 11:36:42 +01:00 committed by Copybot
parent 7daebe2f42
commit aba4694377
3 changed files with 10 additions and 4 deletions

View file

@ -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)

View file

@ -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(),

View file

@ -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,