@fc-components/monaco-editor 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type * as monacoTypes from 'monaco-editor/esm/vs/editor/editor.api';
3
3
  interface SqlEditorProps {
4
+ className?: string;
4
5
  maxHeight?: number | string;
5
6
  fontSize?: number;
6
7
  size?: 'small' | 'middle' | 'large';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.21",
6
+ "version": "0.1.23",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/monaco-editor.esm.js",
@@ -89,7 +89,7 @@ const getStyles = (placeholder?: string) => {
89
89
  export default function PromQLEditor(props: PromQLEditorProps & DataProviderParams) {
90
90
  const id = uuidv4();
91
91
  const {
92
- className = '',
92
+ className,
93
93
  size = 'middle',
94
94
  theme = 'light',
95
95
  value,
@@ -347,11 +347,8 @@ export default function PromQLEditor(props: PromQLEditorProps & DataProviderPara
347
347
  (size ? ` ${SIZE_MAP[size].className}` : '') +
348
348
  (disabled ? ` ant-input-disabled ${containerDisabledClassName}` : '') +
349
349
  (readOnly ? ` ${containerReadOnlyClassName}` : '') +
350
- ` ${className}`
350
+ (className ? ` ${className}` : '')
351
351
  }
352
- style={{
353
- display: 'block',
354
- }}
355
352
  >
356
353
  <div ref={containerRef}>
357
354
  <MonacoEditor
package/src/sql/index.tsx CHANGED
@@ -8,6 +8,7 @@ import { language, languageConfiguration } from './sql';
8
8
  import { getSqlCompletionProvider } from './completion/getCompletionProvider';
9
9
 
10
10
  interface SqlEditorProps {
11
+ className?: string;
11
12
  maxHeight?: number | string;
12
13
  fontSize?: number;
13
14
  size?: 'small' | 'middle' | 'large';
@@ -75,6 +76,7 @@ const containerReadOnlyClassName = css`
75
76
  export default function SqlEditor(props: SqlEditorProps) {
76
77
  const id = uuidv4();
77
78
  const {
79
+ className,
78
80
  maxHeight,
79
81
  fontSize,
80
82
  size = 'middle',
@@ -163,7 +165,7 @@ export default function SqlEditor(props: SqlEditorProps) {
163
165
  const containerDiv = containerRef.current;
164
166
  if (containerDiv !== null) {
165
167
  const pixelHeight = editor.getContentHeight();
166
- containerDiv.style.height = `${pixelHeight}px`;
168
+ containerDiv.style.minHeight = `${pixelHeight}px`;
167
169
  containerDiv.style.width = '100%';
168
170
  const pixelWidth = containerDiv.clientWidth;
169
171
  editor.layout({ width: pixelWidth, height: pixelHeight });
@@ -229,16 +231,23 @@ export default function SqlEditor(props: SqlEditorProps) {
229
231
  'ant-input' +
230
232
  (size ? ` ${SIZE_MAP[size].className}` : '') +
231
233
  (disabled ? ` ant-input-disabled ${containerDisabledClassName}` : '') +
232
- (readOnly ? ` ${containerReadOnlyClassName}` : '')
234
+ (readOnly ? ` ${containerReadOnlyClassName}` : '') +
235
+ (className ? ` ${className}` : '')
233
236
  }
234
237
  style={{
238
+ display: 'block',
235
239
  resize: 'vertical',
236
240
  overflow: 'auto',
237
241
  minHeight: SIZE_MAP[size].minHeight,
238
242
  maxHeight,
239
243
  }}
240
244
  >
241
- <div ref={containerRef}>
245
+ <div
246
+ ref={containerRef}
247
+ style={{
248
+ height: '100%',
249
+ }}
250
+ >
242
251
  <MonacoEditor
243
252
  width='100%'
244
253
  height='100%'