Skip to content

Commit

Permalink
[EuiCodeEditor] Console error when using the editor without importing…
Browse files Browse the repository at this point in the history
… the default theme
  • Loading branch information
alexwizp committed May 11, 2020
1 parent 826bdb5 commit 7384a1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ exports[`EuiCodeEditor is rendered 1`] = `
</p>
</div>
<div
class=" ace_editor ace-tm testClass1 testClass2"
class=" ace_editor ace-github testClass1 testClass2"
id="htmlId"
style="width: 500px; height: 500px;"
>
Expand Down Expand Up @@ -203,7 +203,7 @@ exports[`EuiCodeEditor props aria attributes allows setting aria-describedby on
</p>
</div>
<div
class=" ace_editor ace-tm"
class=" ace_editor ace-github"
id="htmlId"
style="width: 500px; height: 500px;"
>
Expand Down Expand Up @@ -319,7 +319,7 @@ exports[`EuiCodeEditor props aria attributes allows setting aria-labelledby on t
</p>
</div>
<div
class=" ace_editor ace-tm"
class=" ace_editor ace-github"
id="htmlId"
style="width: 500px; height: 500px;"
>
Expand Down Expand Up @@ -435,7 +435,7 @@ exports[`EuiCodeEditor props isReadOnly renders alternate hint text 1`] = `
</p>
</div>
<div
class=" ace_editor ace-tm"
class=" ace_editor ace-github"
id="htmlId"
style="width: 500px; height: 500px;"
>
Expand Down
5 changes: 4 additions & 1 deletion src/components/code_editor/code_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import { keysOf } from '../common';
import { htmlIdGenerator, keyCodes } from '../../services';
import { EuiI18n } from '../i18n';

import 'brace/theme/github';

const DEFAULT_MODE = 'text';
const DEFAULT_THEME = 'github';

function setOrRemoveAttribute(
element: HTMLTextAreaElement,
Expand Down Expand Up @@ -215,7 +218,7 @@ export class EuiCodeEditor extends Component<
cursorStart,
mode = DEFAULT_MODE,
'data-test-subj': dataTestSubj = 'codeEditorContainer',
theme = 'github',
theme = DEFAULT_THEME,
...rest
} = this.props;

Expand Down

0 comments on commit 7384a1f

Please sign in to comment.