From 2ab07793747699afbf69ef0894653f39183d776e Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Mon, 19 Jun 2023 13:24:01 +0200 Subject: [PATCH] [cm6] rename to Code Editor | Visual Editor (#13513) * [cm6] rename to Code Editor | Visual Editor * showLegacySourceEditor change * show info badge * remove info badge * display info badge * use "Visual Editor" in example project GitOrigin-RevId: 549e25aa4bcfe58522eadc70e35ca35f822317b1 --- .../src/Features/Project/ProjectController.js | 70 +------------------ .../project_files/example-project/main.tex | 2 +- .../web/app/views/project/editor/meta.pug | 2 - .../web/frontend/extracted-translations.json | 2 + .../components/editor-switch.tsx | 23 ++---- services/web/locales/en.json | 2 + 6 files changed, 11 insertions(+), 90 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 1c775af550..ccaa065850 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -38,8 +38,6 @@ const InstitutionsFeatures = require('../Institutions/InstitutionsFeatures') const ProjectAuditLogHandler = require('./ProjectAuditLogHandler') const PublicAccessLevels = require('../Authorization/PublicAccessLevels') -const VISUAL_EDITOR_NAMING_SPLIT_TEST_MIN_SIGNUP_DATE = new Date('2023-04-17') - /** * @typedef {import("./types").GetProjectsRequest} GetProjectsRequest * @typedef {import("./types").GetProjectsResponse} GetProjectsResponse @@ -558,60 +556,6 @@ const ProjectController = { } ) }, - participatingInVisualEditorNamingTest: [ - 'user', - (results, cb) => { - const isNewUser = - results.user.signUpDate >= - VISUAL_EDITOR_NAMING_SPLIT_TEST_MIN_SIGNUP_DATE - cb(null, isNewUser) - }, - ], - visualEditorNameAssignment: [ - 'participatingInVisualEditorNamingTest', - (results, cb) => { - if (!results.participatingInVisualEditorNamingTest) { - cb(null, { variant: 'default' }) - } else { - SplitTestHandler.getAssignment( - req, - res, - 'visual-editor-name', - (error, assignment) => { - if (error) { - cb(null, { variant: 'default' }) - } else { - cb(null, assignment) - } - } - ) - } - }, - ], - legacySourceEditorAssignment: [ - 'participatingInVisualEditorNamingTest', - 'visualEditorNameAssignment', - (results, cb) => { - // Hide Ace for people in the Rich Text naming test - if (results.participatingInVisualEditorNamingTest) { - cb(null, { variant: 'true' }) - } else { - SplitTestHandler.getAssignment( - req, - res, - 'source-editor-legacy', - (error, assignment) => { - // do not fail editor load if assignment fails - if (error) { - cb(null, { variant: 'default' }) - } else { - cb(null, assignment) - } - } - ) - } - }, - ], pdfjsAssignment(cb) { SplitTestHandler.getAssignment( req, @@ -848,9 +792,6 @@ const ProjectController = { isTokenMember, isInvitedMember, brandVariation, - visualEditorNameAssignment, - participatingInVisualEditorNamingTest, - legacySourceEditorAssignment, pdfjsAssignment, editorLeftMenuAssignment, richTextAssignment, @@ -941,10 +882,7 @@ const ProjectController = { const showLegacySourceEditor = !Features.hasFeature('saas') || // Allow override via legacy_source_editor=true in query string - shouldDisplayFeature('legacy_source_editor') || - // Hide Ace for beta users - (!user.betaProgram && - legacySourceEditorAssignment.variant === 'default') + shouldDisplayFeature('legacy_source_editor') const editorLeftMenuReact = editorLeftMenuAssignment?.variant === 'react' @@ -980,10 +918,6 @@ const ProjectController = { ? 'project/editor_detached' : 'project/editor' - const isParticipatingInVisualEditorNamingTest = - Features.hasFeature('saas') && - participatingInVisualEditorNamingTest - let richTextVariant if (!Features.hasFeature('saas')) { richTextVariant = 'cm6' @@ -1050,8 +984,6 @@ const ProjectController = { showTemplatesServerPro, pdfjsVariant: pdfjsAssignment.variant, debugPdfDetach, - isParticipatingInVisualEditorNamingTest, - visualEditorNameVariant: visualEditorNameAssignment.variant, showLegacySourceEditor, showSymbolPalette, galileoEnabled, diff --git a/services/web/app/templates/project_files/example-project/main.tex b/services/web/app/templates/project_files/example-project/main.tex index b964f7728a..5199b66d9d 100644 --- a/services/web/app/templates/project_files/example-project/main.tex +++ b/services/web/app/templates/project_files/example-project/main.tex @@ -33,7 +33,7 @@ Once you're familiar with the editor, you can find various project settings in t \subsection{How to create Sections and Subsections} -Simply use the section and subsection commands, as in this example document! With Overleaf, all the formatting and numbering is handled automatically according to the template you've chosen. If you're using Rich Text mode, you can also create new section and subsections via the buttons in the editor toolbar. +Simply use the section and subsection commands, as in this example document! With Overleaf, all the formatting and numbering is handled automatically according to the template you've chosen. If you're using the Visual Editor, you can also create new section and subsections via the buttons in the editor toolbar. \subsection{How to include Figures} diff --git a/services/web/app/views/project/editor/meta.pug b/services/web/app/views/project/editor/meta.pug index 70b085c7ba..adea1a38a0 100644 --- a/services/web/app/views/project/editor/meta.pug +++ b/services/web/app/views/project/editor/meta.pug @@ -22,8 +22,6 @@ meta(name="ol-wsRetryHandshake" data-type="json" content=settings.wsRetryHandsha meta(name="ol-pdfjsVariant" content=pdfjsVariant) meta(name="ol-debugPdfDetach" data-type="boolean" content=debugPdfDetach) meta(name="ol-showLegacySourceEditor", data-type="boolean" content=showLegacySourceEditor) -meta(name="ol-visualEditorNameVariant", data-type="string" content=visualEditorNameVariant) -meta(name="ol-isParticipatingInVisualEditorNamingTest", data-type="boolean" content=isParticipatingInVisualEditorNamingTest) meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette) meta(name="ol-galileoEnabled" data-type="string" content=galileoEnabled) meta(name="ol-galileoPromptWords" data-type="string" content=galileoPromptWords) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 50d3ee18f3..dbb16c6bda 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -127,6 +127,7 @@ "clsi_unavailable": "", "code_check_failed": "", "code_check_failed_explanation": "", + "code_editor": "", "collaborate_online_and_offline": "", "collabs_per_proj": "", "collabs_per_proj_single": "", @@ -1083,6 +1084,7 @@ "view_pdf": "", "view_your_invoices": "", "viewing_x": "", + "visual_editor": "", "want_change_to_apply_before_plan_end": "", "we_cant_find_any_sections_or_subsections_in_this_file": "", "we_logged_you_in": "", diff --git a/services/web/frontend/js/features/source-editor/components/editor-switch.tsx b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx index 8bb95d53df..f168902d01 100644 --- a/services/web/frontend/js/features/source-editor/components/editor-switch.tsx +++ b/services/web/frontend/js/features/source-editor/components/editor-switch.tsx @@ -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} /> {showLegacySourceEditor ? ( @@ -143,7 +133,7 @@ function EditorSwitch() { /> - {!!richTextOrVisual && !isParticipatingInVisualEditorNamingTest && ( + {!!richTextOrVisual && ( )} @@ -157,9 +147,6 @@ const RichTextToggle: FC<{ }> = ({ checked, disabled, handleChange }) => { const { t } = useTranslation() - const richTextName = - visualEditorNameVariant === 'default' ? 'Rich Text' : 'Visual Editor' - const toggle = ( ) diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 25556186fe..bd49519d8a 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -231,6 +231,7 @@ "cn": "Chinese (Simplified)", "code_check_failed": "Code check failed", "code_check_failed_explanation": "Your code has errors that need to be fixed before the auto-compile can run", + "code_editor": "Code Editor", "collaborate_online_and_offline": "Collaborate online and offline, using your own workflow", "collaboration": "Collaboration", "collaborator": "Collaborator", @@ -1752,6 +1753,7 @@ "view_which_changes": "View which changes have been", "view_your_invoices": "View Your Invoices", "viewing_x": "Viewing <0>__endTime__", + "visual_editor": "Visual Editor", "want_change_to_apply_before_plan_end": "If you wish this change to apply before the end of your current billing period, please contact us.", "we_cant_find_any_sections_or_subsections_in_this_file": "We can’t find any sections or subsections in this file", "we_logged_you_in": "We have logged you in.",