Skip to content
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

[EuiCodeEditor] Add deprecation console warning #4984

Merged
merged 12 commits into from
Jul 28, 2021
19 changes: 19 additions & 0 deletions src-docs/src/views/code/code_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { Link } from 'react-router-dom';
import { GuideSectionTypes } from '../../components';

import {
EuiCallOut,
EuiCode,
EuiCodeBlock,
EuiLink,
EuiText,
EuiSpacer,
} from '../../../../src/components';
import { codeBlockConfig, codeConfig } from './playground';

Expand Down Expand Up @@ -39,6 +41,23 @@ export const CodeExample = {
title: 'Code',
intro: (
<>
<EuiCallOut title="EUI provides support for static code">
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
<p>
<strong>EuiCode</strong> and <strong>EuiCodeBlock</strong> are
intended to render static lines or blocks of code in read-only
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
contexts.
<br />
If you need capabilities to edit, or want to print long code (e.g.,
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
printing JSON from an API), use{' '}
<EuiLink
external
href="https://github.com/elastic/kibana/tree/master/src/plugins/kibana_react/public/code_editor">
<strong>CodeEditor</strong> (within Kibana)
</EuiLink>
.
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
</p>
</EuiCallOut>
<EuiSpacer />
<EuiText>
<p>
The <strong>EuiCode</strong> and <strong>EuiCodeBlock</strong>{' '}
Expand Down
3 changes: 3 additions & 0 deletions src/components/code_editor/code_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { keysOf } from '../common';
import { htmlIdGenerator, keys } from '../../services';
import { EuiI18n } from '../i18n';

console.warn(`[EUI] - DEPRECATION: \`EuiCodeEditor\` is deprecated and will be removed in a future release.
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
See https://ela.st/euicodeeditor for migration options.`);

const DEFAULT_MODE = 'text';
const DEFAULT_THEME = 'textmate';

Expand Down