import { ChangeEvent, FC, memo, useCallback } from 'react' import useScopeValue from '../../../shared/hooks/use-scope-value' import Tooltip from '../../../shared/components/tooltip' import { sendMB } from '../../../infrastructure/event-tracking' import isValidTeXFile from '../../../main/is-valid-tex-file' import { useTranslation } from 'react-i18next' import { PromotionOverlay } from './table-generator/promotion/popover' function EditorSwitch() { const { t } = useTranslation() const [visual, setVisual] = useScopeValue('editor.showVisual') const [docName] = useScopeValue('editor.open_doc_name') const richTextAvailable = isValidTeXFile(docName) const handleChange = useCallback( event => { const editorType = event.target.value switch (editorType) { case 'cm6': setVisual(false) break case 'rich-text': setVisual(true) break } sendMB('editor-switch-change', { editorType }) }, [setVisual] ) return (