Skip to content

Commit

Permalink
Set the CodeEditor width to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Nov 3, 2020
1 parent 14ccc9a commit d1147c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import React from 'react';
import { i18n } from '@kbn/i18n';
import { PainlessLang } from '@kbn/monaco';
import { EuiFormRow, EuiDescribedFormGroup } from '@elastic/eui';

import { CodeEditor, UseField } from '../../../shared_imports';
Expand All @@ -18,19 +19,18 @@ interface Props {

export const PainlessScriptParameter = ({ stack }: Props) => {
return (
<UseField path="script.source" config={getFieldConfig('script')}>
<UseField<string> path="script.source" config={getFieldConfig('script')}>
{(scriptField) => {
const error = scriptField.getErrorsMessages();
const isInvalid = error ? Boolean(error.length) : false;

const field = (
<EuiFormRow label={scriptField.label} error={error} isInvalid={isInvalid} fullWidth>
<CodeEditor
languageId="painless"
// 99% width allows the editor to resize horizontally. 100% prevents it from resizing.
width="99%"
languageId={PainlessLang.ID}
width="100%"
height="400px"
value={scriptField.value as string}
value={scriptField.value}
onChange={scriptField.setValue}
options={{
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ const RuntimeFieldFormComp = ({ defaultValue, onChange, links }: Props) => {
>
<CodeEditor
languageId={PainlessLang.ID}
// 99% width allows the editor to resize horizontally. 100% prevents it from resizing.
width="99%"
width="100%"
height="300px"
value={value}
onChange={setValue}
Expand Down

0 comments on commit d1147c3

Please sign in to comment.