Skip to content

Commit 19ef805

Browse files
authored
fix: backport changes for html button in text component markdown editor (#2065)
1 parent 2beb91c commit 19ef805

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/editors/sharedComponents/CodeEditor/hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const createCodeMirrorDomNode = ({
100100
}) => {
101101
// eslint-disable-next-line react-hooks/rules-of-hooks
102102
useEffect(() => {
103-
const languageExtension = CODEMIRROR_LANGUAGES[lang]();
103+
const languageExtension = CODEMIRROR_LANGUAGES[lang] ? CODEMIRROR_LANGUAGES[lang]() : xml();
104104
const cleanText = cleanHTML({ initialText });
105105
const newState = EditorState.create({
106106
doc: cleanText,

src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = `
4141
>
4242
<injectIntl(ShimmedIntlComponent)
4343
innerRef="moCKrEf"
44+
lang="html"
4445
value="mOckHtMl"
4546
/>
4647
</div>

src/editors/sharedComponents/SourceCodeModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import PropTypes from 'prop-types';
32

43
import {
@@ -41,6 +40,7 @@ const SourceCodeModal = ({
4140
<CodeEditor
4241
innerRef={ref}
4342
value={value}
43+
lang="html" // hardcoded value to do lookup on CODEMIRROR_LANGUAGES
4444
/>
4545
</div>
4646
</BaseModal>

0 commit comments

Comments
 (0)