[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
This commit is contained in:
Domagoj Kriskovic 2023-06-19 13:24:01 +02:00 committed by Copybot
parent 98aa084089
commit 2ab0779374
6 changed files with 11 additions and 90 deletions

View file

@ -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,

View file

@ -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}

View file

@ -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)

View file

@ -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": "",

View file

@ -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>
)

View file

@ -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__</0>",
"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 cant find any sections or subsections in this file",
"we_logged_you_in": "We have logged you in.",