latex-ub/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts
2025-05-05 12:24:05 +00:00

13 lines
523 B
TypeScript

import { useUserSettingsContext } from '@/shared/context/user-settings-context'
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
// TODO: For now we're using the feature flag, but eventually we'll read this
// from labs.
export const canUseNewEditor = () => isSplitTestEnabled('editor-redesign')
export const useIsNewEditorEnabled = () => {
const { userSettings } = useUserSettingsContext()
const hasAccess = canUseNewEditor()
const enabled = userSettings.enableNewEditor
return hasAccess && enabled
}