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 ( + + + {content} + + + ) +} function EditorSwitch() { const [newSourceEditor, setNewSourceEditor] = useScopeValue( @@ -31,26 +64,9 @@ function EditorSwitch() { [setRichText, setNewSourceEditor] ) - const tooltip = useMemo(() => { - return { - id: 'editor-switch-tooltip', - placement: 'bottom', - className: 'tooltip-wide', - text: ( - <> - We are upgrading the source editor. Please test it by selecting - "Source (Beta)". -
-
- Click to learn more and give feedback - - ), - } - }, []) - return (
- +
Editor mode. @@ -65,7 +81,7 @@ function EditorSwitch() { onChange={handleChange} />