Skip to content

Commit 7dfb53c

Browse files
committed
Adjust to Coker's new suggestions
1 parent 4b7c712 commit 7dfb53c

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,11 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
644644

645645
const editor = (
646646
<div
647-
className={css(styles.codeEditorCode, isFullHeight && styles.modifiers.fullHeight)}
647+
className={css(styles.codeEditorCode)}
648648
ref={this.wrapperRef}
649649
tabIndex={0}
650650
dir="ltr"
651+
style={{ height: '100%' }}
651652
>
652653
<Editor
653654
height={height === '100%' ? undefined : height}
@@ -666,28 +667,26 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
666667

667668
return (
668669
<div
669-
className={css(
670-
styles.codeEditor,
671-
isReadOnly && styles.modifiers.readOnly,
672-
isFullHeight && styles.modifiers.fullHeight,
673-
className
674-
)}
670+
className={css(styles.codeEditor, isReadOnly && styles.modifiers.readOnly, className)}
675671
ref={this.ref}
672+
style={
673+
isFullHeight
674+
? { height: '100%', display: 'flex', flexDirection: 'column' }
675+
: { display: 'flex', flexDirection: 'column' }
676+
}
676677
>
677678
{isUploadEnabled || providedEmptyState ? (
678679
<div
679680
{...getRootProps({
680681
onClick: (event) => event.stopPropagation() // Prevents clicking TextArea from opening file dialog
681682
})}
682683
className={css(isLoading && fileUploadStyles.modifiers.loading)}
684+
style={{ display: 'flex', flexDirection: 'column', flexGrow: '1' }}
683685
>
684686
{editorHeader}
685687
<div
686-
className={css(
687-
styles.codeEditorMain,
688-
isDragActive && styles.modifiers.dragHover,
689-
isFullHeight && styles.modifiers.fullHeight
690-
)}
688+
className={css(styles.codeEditorMain, isDragActive && styles.modifiers.dragHover)}
689+
style={{ flexGrow: 1 }}
691690
>
692691
<div className={css(styles.codeEditorUpload)}>
693692
<input {...getInputProps()} /* hidden, necessary for react-dropzone */ />
@@ -699,7 +698,7 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
699698
<>
700699
{editorHeader}
701700
{showEditor && (
702-
<div className={css(styles.codeEditorMain, isFullHeight && styles.modifiers.fullHeight)}>
701+
<div className={css(styles.codeEditorMain)} style={{ flexGrow: 1 }}>
703702
{editor}
704703
</div>
705704
)}

0 commit comments

Comments
 (0)