From 72a211b58f9cd81cb81cecca68de14367fdf6853 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 8 Oct 2023 13:12:46 +0200 Subject: [PATCH] Revert "fix(codemirror): remove defect language highlighting" This reverts commit 6e36ab56b72a7c25f43e206a4f2617981d5b0ba7. Signed-off-by: Tilman Vatteroth --- .../src/components/editor-page/editor-pane/editor-pane.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/components/editor-page/editor-pane/editor-pane.tsx b/frontend/src/components/editor-page/editor-pane/editor-pane.tsx index edd2a5740..44bf89fac 100644 --- a/frontend/src/components/editor-page/editor-pane/editor-pane.tsx +++ b/frontend/src/components/editor-page/editor-pane/editor-pane.tsx @@ -9,6 +9,7 @@ import { useMayEdit } from '../../../hooks/common/use-may-edit' import { useTranslatedText } from '../../../hooks/common/use-translated-text' import { useDarkModeState } from '../../../hooks/dark-mode/use-dark-mode-state' import { cypressAttribute, cypressId } from '../../../utils/cypress-attribute' +import { findLanguageByCodeBlockName } from '../../markdown-renderer/extensions/_base-classes/code-block-markdown-extension/find-language-by-code-block-name' import type { ScrollProps } from '../synced-scroll/scroll-props' import styles from './extended-codemirror/codemirror.module.scss' import { useCodeMirrorAutocompletionsExtension } from './hooks/codemirror-extensions/use-code-mirror-autocompletions-extension' @@ -36,6 +37,8 @@ import { useLinter } from './linter/linter' import { MaxLengthWarning } from './max-length-warning/max-length-warning' import { StatusBar } from './status-bar/status-bar' import { ToolBar } from './tool-bar/tool-bar' +import { markdown, markdownLanguage } from '@codemirror/lang-markdown' +import { languages } from '@codemirror/language-data' import { lintGutter } from '@codemirror/lint' import { oneDark } from '@codemirror/theme-one-dark' import ReactCodeMirror from '@uiw/react-codemirror' @@ -91,6 +94,10 @@ export const EditorPane: React.FC = ({ scrollState, onScroll, o () => [ linterExtension, lintGutter(), + markdown({ + base: markdownLanguage, + codeLanguages: (input) => findLanguageByCodeBlockName(languages, input) + }), remoteCursorsExtension, lineWrappingExtension, editorScrollExtension,