Skip to content

Commit 051b5e3

Browse files
committed
fix: Ensure adequate SQL/Schema Preview modal height
1 parent 52d2798 commit 051b5e3

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/app/src/components/SQLInlineEditor.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ type SQLInlineEditorProps = {
129129

130130
const MAX_EDITOR_HEIGHT = '150px';
131131

132-
const createStyleTheme = (allowMultiline: boolean = false) =>
132+
const createStyleTheme = () =>
133133
EditorView.baseTheme({
134134
'&.cm-editor.cm-focused': {
135135
outline: '0px solid transparent',
136136
},
137137
'&.cm-editor': {
138138
background: 'transparent !important',
139-
...(allowMultiline && { maxHeight: MAX_EDITOR_HEIGHT }),
139+
},
140+
'.cm-editor-multiline &.cm-editor': {
141+
maxHeight: MAX_EDITOR_HEIGHT,
140142
},
141143
'& .cm-tooltip-autocomplete': {
142144
whiteSpace: 'nowrap',
@@ -185,10 +187,10 @@ const createStyleTheme = (allowMultiline: boolean = false) =>
185187
},
186188
'& .cm-scroller': {
187189
overflowX: 'hidden',
188-
...(allowMultiline && {
189-
maxHeight: MAX_EDITOR_HEIGHT,
190-
overflowY: 'auto',
191-
}),
190+
},
191+
'.cm-editor-multiline & .cm-scroller': {
192+
maxHeight: MAX_EDITOR_HEIGHT,
193+
overflowY: 'auto',
192194
},
193195
});
194196

@@ -365,7 +367,7 @@ export default function SQLInlineEditor({
365367
const cmExtensions = useMemo(
366368
() => [
367369
...tooltipExt,
368-
createStyleTheme(allowMultiline),
370+
createStyleTheme(),
369371
...(allowMultiline ? [EditorView.lineWrapping] : []),
370372
compartmentRef.current.of(
371373
sql({
@@ -441,7 +443,10 @@ export default function SQLInlineEditor({
441443
</Tooltip>
442444
</Text>
443445
)}
444-
<div style={{ minWidth: 10, width: '100%' }}>
446+
<div
447+
style={{ minWidth: 10, width: '100%' }}
448+
className={allowMultiline ? 'cm-editor-multiline' : ''}
449+
>
445450
<CodeMirror
446451
indentWithTab={false}
447452
ref={ref}

0 commit comments

Comments
 (0)