mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
Allow enabling EditContext in CodeMirror (#29114)
GitOrigin-RevId: 15d70fd2d5da68d43f441bb0c65ff0cd2d785306
This commit is contained in:
@@ -4,7 +4,6 @@ import localesPromise from '@/i18n'
|
||||
import './shared/commands'
|
||||
import './shared/exceptions'
|
||||
import './ct/commands'
|
||||
import './ct/codemirror'
|
||||
import '../../test/frontend/helpers/bootstrap'
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import { EditorView } from '@codemirror/view'
|
||||
|
||||
// @ts-ignore (disable EditContext-based editing until stable)
|
||||
EditorView.EDIT_CONTEXT = false
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import MathPreviewTooltip from './math-preview-tooltip'
|
||||
import { useToolbarMenuBarEditorCommands } from '@/features/ide-redesign/hooks/use-toolbar-menu-editor-commands'
|
||||
import { useProjectContext } from '@/shared/context/project-context'
|
||||
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
||||
|
||||
// TODO: remove this when definitely no longer used
|
||||
export * from './codemirror-context'
|
||||
@@ -34,12 +35,15 @@ function CodeMirrorEditor() {
|
||||
})
|
||||
|
||||
const isMounted = useIsMounted()
|
||||
const editContextEnabled = useFeatureFlag('edit-context')
|
||||
|
||||
// create the view using the initial state and intercept transactions
|
||||
const viewRef = useRef<EditorView | null>(null)
|
||||
if (viewRef.current === null) {
|
||||
// @ts-ignore (disable EditContext-based editing until stable)
|
||||
EditorView.EDIT_CONTEXT = false
|
||||
if (!editContextEnabled) {
|
||||
// @ts-expect-error (disable EditContext-based editing until stable)
|
||||
EditorView.EDIT_CONTEXT = false
|
||||
}
|
||||
|
||||
const view = new EditorView({
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user