Skip to content

Html button in text component editor backport #2064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/editors/sharedComponents/CodeEditor/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = `
>
<injectIntl(ShimmedIntlComponent)
innerRef="moCKrEf"
lang="html"
value="mOckHtMl"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/editors/sharedComponents/SourceCodeModal/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

import {
Expand Down Expand Up @@ -41,6 +40,7 @@ const SourceCodeModal = ({
<CodeEditor
innerRef={ref}
value={value}
lang="html" // hardcoded value to do lookup on CODEMIRROR_LANGUAGES
/>
</div>
</BaseModal>
Expand Down