From 41c715c40df592a9810c23cfee5a2e2e459cb948 Mon Sep 17 00:00:00 2001
From: ilkin-overleaf <100852799+ilkin-overleaf@users.noreply.github.com>
Date: Tue, 14 Jun 2022 13:58:57 +0300
Subject: [PATCH] Merge pull request #8378 from
overleaf/ii-cm6-three-way-toggle
[cm6] Make cm6 as the default source editor
GitOrigin-RevId: b56724d2c147792c55ce01cf272fbcce16f87916
---
.../src/Features/Project/ProjectController.js | 1 +
.../{editor-switch.js => editor-switch.tsx} | 60 ++++++++++++-------
.../frontend/js/ide/editor/EditorManager.js | 8 ++-
3 files changed, 44 insertions(+), 25 deletions(-)
rename services/web/frontend/js/features/source-editor/components/{editor-switch.js => editor-switch.tsx} (70%)
diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js
index f7aad09591..c24a7a2a97 100644
--- a/services/web/app/src/Features/Project/ProjectController.js
+++ b/services/web/app/src/Features/Project/ProjectController.js
@@ -1015,6 +1015,7 @@ const ProjectController = {
const showNewSourceEditorOption =
(newSourceEditorAssignment &&
newSourceEditorAssignment.variant === 'codemirror') ||
+ user.betaProgram ||
shouldDisplayFeature('new_source_editor', false) // also allow override via ?new_source_editor=true
const showSymbolPalette =
diff --git a/services/web/frontend/js/features/source-editor/components/editor-switch.js b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx
similarity index 70%
rename from services/web/frontend/js/features/source-editor/components/editor-switch.js
rename to services/web/frontend/js/features/source-editor/components/editor-switch.tsx
index c2847ab42f..bf9e594574 100644
--- a/services/web/frontend/js/features/source-editor/components/editor-switch.js
+++ b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx
@@ -1,6 +1,39 @@
-import { memo, useCallback, useMemo } from 'react'
+import { memo, useCallback } from 'react'
import useScopeValue from '../../../shared/hooks/use-scope-value'
-import BetaBadge from '../../../shared/components/beta-badge'
+import Tooltip from '../../../shared/components/tooltip'
+
+function Badge() {
+ const content = (
+ <>
+ Overleaf has upgraded the source editor. You can still use the old editor
+ by selecting "Source (legacy)".
+
+
+ Click to learn more and give feedback
+ >
+ )
+
+ return (
+
-
- Click to learn more and give feedback
- >
- ),
- }
- }, [])
-
return (