fix: backport changes for html button in text component markdown editor (#2065)

This commit is contained in:
Tony Busa
2025-06-04 06:21:05 -06:00
committed by GitHub
parent 2beb91c63b
commit 19ef80553a
3 changed files with 3 additions and 2 deletions

View File

@@ -100,7 +100,7 @@ export const createCodeMirrorDomNode = ({
}) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
const languageExtension = CODEMIRROR_LANGUAGES[lang]();
const languageExtension = CODEMIRROR_LANGUAGES[lang] ? CODEMIRROR_LANGUAGES[lang]() : xml();
const cleanText = cleanHTML({ initialText });
const newState = EditorState.create({
doc: cleanText,

View File

@@ -41,6 +41,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = `
>
<injectIntl(ShimmedIntlComponent)
innerRef="moCKrEf"
lang="html"
value="mOckHtMl"
/>
</div>

View File

@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
@@ -41,6 +40,7 @@ const SourceCodeModal = ({
<CodeEditor
innerRef={ref}
value={value}
lang="html" // hardcoded value to do lookup on CODEMIRROR_LANGUAGES
/>
</div>
</BaseModal>