mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
8f2001e477
Prepare editor redesign for beta release GitOrigin-RevId: 584c0303f652640669234bd227780ed4f20b76c0
25 lines
804 B
TypeScript
25 lines
804 B
TypeScript
import { useUserSettingsContext } from '@/shared/context/user-settings-context'
|
|
import { isInExperiment } from '@/utils/labs-utils'
|
|
import getMeta from '@/utils/meta'
|
|
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
|
|
|
|
export const isNewEditorInBeta = () => {
|
|
const splitTestInfo = getMeta('ol-splitTestInfo') || {}
|
|
return splitTestInfo['editor-redesign']?.phase === 'beta'
|
|
}
|
|
|
|
export const canUseNewEditor = () => {
|
|
const inBetaPhase = isNewEditorInBeta()
|
|
return (
|
|
(!inBetaPhase && isInExperiment('editor-redesign')) ||
|
|
isSplitTestEnabled('editor-redesign')
|
|
)
|
|
}
|
|
|
|
export const useIsNewEditorEnabled = () => {
|
|
const { userSettings } = useUserSettingsContext()
|
|
const hasAccess = canUseNewEditor()
|
|
const enabled = userSettings.enableNewEditor
|
|
return hasAccess && enabled
|
|
}
|