new-editor-utils.ts 523 B

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