mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -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',
|
!anonymous && 'writefull-oauth-promotion',
|
||||||
'ieee-stylesheet',
|
'ieee-stylesheet',
|
||||||
'write-and-cite',
|
'write-and-cite',
|
||||||
|
'write-and-cite-ars',
|
||||||
'default-visual-for-beginners',
|
'default-visual-for-beginners',
|
||||||
'spell-check-client',
|
'spell-check-client',
|
||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
|
|
|
@ -54,9 +54,10 @@ import { ranges } from './ranges'
|
||||||
import { trackDetachedComments } from './track-detached-comments'
|
import { trackDetachedComments } from './track-detached-comments'
|
||||||
import { addComment } from './add-comment'
|
import { addComment } from './add-comment'
|
||||||
|
|
||||||
const moduleExtensions: Array<() => Extension> = importOverleafModules(
|
const moduleExtensions: Array<(options: Record<string, any>) => Extension> =
|
||||||
'sourceEditorExtensions'
|
importOverleafModules('sourceEditorExtensions').map(
|
||||||
).map((item: { import: { extension: Extension } }) => item.import.extension)
|
(item: { import: { extension: Extension } }) => item.import.extension
|
||||||
|
)
|
||||||
|
|
||||||
export const createExtensions = (options: Record<string, any>): Extension[] => [
|
export const createExtensions = (options: Record<string, any>): Extension[] => [
|
||||||
lineNumbers(),
|
lineNumbers(),
|
||||||
|
@ -145,7 +146,7 @@ export const createExtensions = (options: Record<string, any>): Extension[] => [
|
||||||
// Send exceptions to Sentry
|
// Send exceptions to Sentry
|
||||||
EditorView.exceptionSink.of(options.handleException),
|
EditorView.exceptionSink.of(options.handleException),
|
||||||
// CodeMirror extensions provided by modules
|
// CodeMirror extensions provided by modules
|
||||||
moduleExtensions.map(extension => extension()),
|
moduleExtensions.map(extension => extension(options)),
|
||||||
thirdPartyExtensions(),
|
thirdPartyExtensions(),
|
||||||
effectListeners(),
|
effectListeners(),
|
||||||
geometryChangeEvent(),
|
geometryChangeEvent(),
|
||||||
|
|
|
@ -111,6 +111,7 @@ function useCodeMirrorScope(view: EditorView) {
|
||||||
const [spellCheckLanguage] = useScopeValue<string>(
|
const [spellCheckLanguage] = useScopeValue<string>(
|
||||||
'project.spellCheckLanguage'
|
'project.spellCheckLanguage'
|
||||||
)
|
)
|
||||||
|
const [projectFeatures] = useScopeValue<boolean>('project.features')
|
||||||
|
|
||||||
const hunspellManager = useHunspell(spellCheckLanguage)
|
const hunspellManager = useHunspell(spellCheckLanguage)
|
||||||
|
|
||||||
|
@ -228,6 +229,8 @@ function useCodeMirrorScope(view: EditorView) {
|
||||||
view.dispatch(setSpellCheckLanguage(spellingRef.current))
|
view.dispatch(setSpellCheckLanguage(spellingRef.current))
|
||||||
}, [view, spellCheckLanguage, hunspellManager])
|
}, [view, spellCheckLanguage, hunspellManager])
|
||||||
|
|
||||||
|
const projectFeaturesRef = useRef(projectFeatures)
|
||||||
|
|
||||||
// listen to doc:after-opened, and focus the editor if it's not a new doc
|
// listen to doc:after-opened, and focus the editor if it's not a new doc
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const listener: EventListener = event => {
|
const listener: EventListener = event => {
|
||||||
|
@ -326,6 +329,7 @@ function useCodeMirrorScope(view: EditorView) {
|
||||||
phrases: phrasesRef.current,
|
phrases: phrasesRef.current,
|
||||||
spelling: spellingRef.current,
|
spelling: spellingRef.current,
|
||||||
visual: visualRef.current,
|
visual: visualRef.current,
|
||||||
|
projectFeatures: projectFeaturesRef.current,
|
||||||
changeManager: createChangeManager(view, currentDoc),
|
changeManager: createChangeManager(view, currentDoc),
|
||||||
handleError,
|
handleError,
|
||||||
handleException,
|
handleException,
|
||||||
|
|
Loading…
Reference in a new issue