From 19ef80553a396e8df19644feb9bc3039123d7cc4 Mon Sep 17 00:00:00 2001 From: Tony Busa <70979397+tonybusa@users.noreply.github.com> Date: Wed, 4 Jun 2025 06:21:05 -0600 Subject: [PATCH] fix: backport changes for html button in text component markdown editor (#2065) --- src/editors/sharedComponents/CodeEditor/hooks.js | 2 +- .../SourceCodeModal/__snapshots__/index.test.jsx.snap | 1 + src/editors/sharedComponents/SourceCodeModal/index.jsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/editors/sharedComponents/CodeEditor/hooks.js b/src/editors/sharedComponents/CodeEditor/hooks.js index 0eb25a7cc..a15e64bf1 100644 --- a/src/editors/sharedComponents/CodeEditor/hooks.js +++ b/src/editors/sharedComponents/CodeEditor/hooks.js @@ -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, diff --git a/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap b/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap index 94cfe0449..91ea6175a 100644 --- a/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap +++ b/src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap @@ -41,6 +41,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = ` > diff --git a/src/editors/sharedComponents/SourceCodeModal/index.jsx b/src/editors/sharedComponents/SourceCodeModal/index.jsx index 88f7ff9f8..9282a180c 100644 --- a/src/editors/sharedComponents/SourceCodeModal/index.jsx +++ b/src/editors/sharedComponents/SourceCodeModal/index.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { @@ -41,6 +40,7 @@ const SourceCodeModal = ({