mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't show cm6 switch away survey if cm6 is not available
GitOrigin-RevId: e283fc424055f6df85015f02c83ad8314865697d
This commit is contained in:
parent
7493be028d
commit
b593bfa56e
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { Button } from 'react-bootstrap'
|
import { Button } from 'react-bootstrap'
|
||||||
import customLocalStorage from '../../../infrastructure/local-storage'
|
import customLocalStorage from '../../../infrastructure/local-storage'
|
||||||
import useScopeValue from '../../../shared/hooks/use-scope-value'
|
import useScopeValue from '../../../shared/hooks/use-scope-value'
|
||||||
|
import getMeta from '../../../utils/meta'
|
||||||
|
|
||||||
type CM6SwitchAwaySurveyState = 'disabled' | 'enabled' | 'shown'
|
type CM6SwitchAwaySurveyState = 'disabled' | 'enabled' | 'shown'
|
||||||
|
|
||||||
|
@ -12,6 +13,11 @@ export default function CM6SwitchAwaySurvey() {
|
||||||
const initialRichTextPreference = useRef<boolean>(richText)
|
const initialRichTextPreference = useRef<boolean>(richText)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// if cm6 is not available, don't show the survey
|
||||||
|
if (!getMeta('ol-showNewSourceEditorOption')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// If the user has previously seen the survey, then don't show it again
|
// If the user has previously seen the survey, then don't show it again
|
||||||
const hasSeenCM6SwitchAwaySurvey = customLocalStorage.getItem(
|
const hasSeenCM6SwitchAwaySurvey = customLocalStorage.getItem(
|
||||||
'editor.has_seen_cm6_switch_away_survey'
|
'editor.has_seen_cm6_switch_away_survey'
|
||||||
|
|
Loading…
Reference in a new issue