mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[cm6] fix old editor-switch to show code editor (#13645)
* [cm6] fix old editor-switch to show code editor * prettier GitOrigin-RevId: 2c40c249c649b2675963db37a2aaeb4f0c457f7a
This commit is contained in:
parent
17452b51d7
commit
86753c19e5
1 changed files with 5 additions and 18 deletions
|
@ -3,9 +3,9 @@ import useScopeValue from '../../../shared/hooks/use-scope-value'
|
|||
import Tooltip from '../../../shared/components/tooltip'
|
||||
import { sendMB } from '../../../infrastructure/event-tracking'
|
||||
import getMeta from '../../../utils/meta'
|
||||
import SplitTestBadge from '../../../shared/components/split-test-badge'
|
||||
import isValidTeXFile from '../../../main/is-valid-tex-file'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import SplitTestBadge from '../../../shared/components/split-test-badge'
|
||||
|
||||
function Badge() {
|
||||
const content = (
|
||||
|
@ -41,23 +41,13 @@ function Badge() {
|
|||
}
|
||||
|
||||
const showLegacySourceEditor: boolean = getMeta('ol-showLegacySourceEditor')
|
||||
const visualEditorNameVariant: string = getMeta('ol-visualEditorNameVariant')
|
||||
const isParticipatingInVisualEditorNamingTest: boolean = getMeta(
|
||||
'ol-isParticipatingInVisualEditorNamingTest'
|
||||
)
|
||||
|
||||
function EditorSwitch() {
|
||||
const { t } = useTranslation()
|
||||
const [newSourceEditor, setNewSourceEditor] = useScopeValue(
|
||||
'editor.newSourceEditor'
|
||||
)
|
||||
const [richText, setRichText] = useScopeValue('editor.showRichText')
|
||||
const sourceName =
|
||||
visualEditorNameVariant === 'code-visual'
|
||||
? 'Code Editor'
|
||||
: visualEditorNameVariant === 'source-visual'
|
||||
? 'Source Editor'
|
||||
: 'Source'
|
||||
|
||||
const [visual, setVisual] = useScopeValue('editor.showVisual')
|
||||
|
||||
const [docName] = useScopeValue('editor.open_doc_name')
|
||||
|
@ -116,7 +106,7 @@ function EditorSwitch() {
|
|||
onChange={handleChange}
|
||||
/>
|
||||
<label htmlFor="editor-switch-cm6" className="toggle-switch-label">
|
||||
<span>{sourceName}</span>
|
||||
<span>{t('code_editor')}</span>
|
||||
</label>
|
||||
|
||||
{showLegacySourceEditor ? (
|
||||
|
@ -143,7 +133,7 @@ function EditorSwitch() {
|
|||
/>
|
||||
</fieldset>
|
||||
|
||||
{!!richTextOrVisual && !isParticipatingInVisualEditorNamingTest && (
|
||||
{!!richTextOrVisual && (
|
||||
<SplitTestBadge splitTestName="rich-text" displayOnVariants={['cm6']} />
|
||||
)}
|
||||
</div>
|
||||
|
@ -157,9 +147,6 @@ const RichTextToggle: FC<{
|
|||
}> = ({ checked, disabled, handleChange }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const richTextName =
|
||||
visualEditorNameVariant === 'default' ? 'Rich Text' : 'Visual Editor'
|
||||
|
||||
const toggle = (
|
||||
<span>
|
||||
<input
|
||||
|
@ -173,7 +160,7 @@ const RichTextToggle: FC<{
|
|||
disabled={disabled}
|
||||
/>
|
||||
<label htmlFor="editor-switch-rich-text" className="toggle-switch-label">
|
||||
<span>{richTextName}</span>
|
||||
<span>{t('visual_editor')}</span>
|
||||
</label>
|
||||
</span>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue