From daec7e70d74883be87f75e11a2639d1650210465 Mon Sep 17 00:00:00 2001 From: Rebecca Alpert Date: Wed, 18 Sep 2024 14:05:30 -0400 Subject: [PATCH] Switch to modifier classes --- .../src/components/CodeEditor/CodeEditor.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx b/packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx index 7866e08bad7..38d0f122dbc 100644 --- a/packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx +++ b/packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx @@ -149,7 +149,7 @@ export interface CodeEditorProps extends Omit, ' emptyStateTitle?: React.ReactNode; /** Editor header main content title. */ headerMainContent?: string; - /** Height of code editor. Defaults to 100%. 'sizeToFit' will automatically change the height + /** Height of code editor. 'sizeToFit' will automatically change the height * to the height of the content. */ height?: string | 'sizeToFit'; @@ -157,6 +157,8 @@ export interface CodeEditorProps extends Omit, ' isCopyEnabled?: boolean; /** Flag indicating the editor is styled using monaco's dark theme. */ isDarkTheme?: boolean; + /** Flag that enables component to consume the available height of its container */ + isFullHeight?: boolean; /** Flag indicating the editor has a plain header. */ isHeaderPlain?: boolean; /** Flag to add download button to code editor actions. */ @@ -520,6 +522,7 @@ class CodeEditor extends React.Component { }, ...optionsProp }; + const isFullHeight = this.props.height === '100%' ? true : this.props.isFullHeight; return ( @@ -641,14 +644,13 @@ class CodeEditor extends React.Component { const editor = (
{ return (
{isUploadEnabled || providedEmptyState ? ( @@ -677,8 +683,11 @@ class CodeEditor extends React.Component { > {editorHeader}
@@ -690,7 +699,7 @@ class CodeEditor extends React.Component { <> {editorHeader} {showEditor && ( -
+
{editor}
)}