Merge pull request #11771 from overleaf/msm-force-ace-sp

[web] Force Ace editor in Server Pro

GitOrigin-RevId: 1ea5675ad1c64a15dc30566c02d694feb2aaed3c
This commit is contained in:
Miguel Serrano 2023-02-10 10:08:15 +01:00 committed by Copybot
parent 9cf1373777
commit 286cbc66a8
3 changed files with 25 additions and 17 deletions

View file

@ -1204,6 +1204,7 @@ const ProjectController = {
const detachRole = req.params.detachRole const detachRole = req.params.detachRole
const showLegacySourceEditor = const showLegacySourceEditor =
!Features.hasFeature('saas') ||
legacySourceEditorAssignment.variant === 'default' || legacySourceEditorAssignment.variant === 'default' ||
// Also allow override via legacy_source_editor=true in query string // Also allow override via legacy_source_editor=true in query string
shouldDisplayFeature('legacy_source_editor') shouldDisplayFeature('legacy_source_editor')

View file

@ -49,8 +49,10 @@
else else
.toolbar.toolbar-editor .toolbar.toolbar-editor
if !moduleIncludesAvailable('editor:source-editor')
include ./source-editor
else
div(ng-if="editor.newSourceEditor") div(ng-if="editor.newSourceEditor")
if moduleIncludesAvailable('editor:source-editor')
!= moduleIncludes('editor:source-editor', locals) != moduleIncludes('editor:source-editor', locals)
div(ng-if="!editor.newSourceEditor") div(ng-if="!editor.newSourceEditor")
include ./source-editor include ./source-editor

View file

@ -40,6 +40,7 @@ function Badge() {
} }
const showLegacySourceEditor: boolean = getMeta('ol-showLegacySourceEditor') const showLegacySourceEditor: boolean = getMeta('ol-showLegacySourceEditor')
const hasNewSourceEditor: boolean = getMeta('ol-hasNewSourceEditor')
function EditorSwitch() { function EditorSwitch() {
const [newSourceEditor, setNewSourceEditor] = useScopeValue( const [newSourceEditor, setNewSourceEditor] = useScopeValue(
@ -95,6 +96,8 @@ function EditorSwitch() {
<fieldset className="toggle-switch"> <fieldset className="toggle-switch">
<legend className="sr-only">Editor mode.</legend> <legend className="sr-only">Editor mode.</legend>
{hasNewSourceEditor && (
<>
<input <input
type="radio" type="radio"
name="editor" name="editor"
@ -107,6 +110,8 @@ function EditorSwitch() {
<label htmlFor="editor-switch-cm6" className="toggle-switch-label"> <label htmlFor="editor-switch-cm6" className="toggle-switch-label">
<span>Source</span> <span>Source</span>
</label> </label>
</>
)}
{showLegacySourceEditor ? ( {showLegacySourceEditor ? (
<> <>
@ -120,7 +125,7 @@ function EditorSwitch() {
onChange={handleChange} onChange={handleChange}
/> />
<label htmlFor="editor-switch-ace" className="toggle-switch-label"> <label htmlFor="editor-switch-ace" className="toggle-switch-label">
<span>Source (legacy)</span> <span>{hasNewSourceEditor ? 'Source (legacy)' : 'Source'}</span>
</label> </label>
</> </>
) : null} ) : null}