@snack-uikit/code-editor 0.2.1-preview-44f1f327.0 → 0.2.1-preview-69f7a1cd.0

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.
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { Editor, useMonaco } from '@monaco-editor/react';
14
14
  import cn from 'classnames';
15
- import { useMemo } from 'react';
15
+ import { useEffect, useMemo } from 'react';
16
16
  import { Spinner } from '@snack-uikit/loaders';
17
17
  import { extractSupportProps } from '@snack-uikit/utils';
18
18
  import { CODE_EDITOR_OPTIONS, DEFAULT_THEME_OPTIONS, DEFAULT_THEME_VALUES } from './constants';
@@ -80,5 +80,10 @@ export function CodeEditor(_a) {
80
80
  fontFamily: themeValues.mono.body.s['font-family'],
81
81
  }
82
82
  : DEFAULT_THEME_OPTIONS.mono.s)), options)), [options, themeValues === null || themeValues === void 0 ? void 0 : themeValues.mono]);
83
+ useEffect(() => {
84
+ // eslint-disable-next-line no-console
85
+ console.log('!_! remeasureFonts');
86
+ setTimeout(() => monaco === null || monaco === void 0 ? void 0 : monaco.editor.remeasureFonts(), 0);
87
+ }, [mergedOptions, monaco === null || monaco === void 0 ? void 0 : monaco.editor]);
83
88
  return (_jsx("div", Object.assign({ className: className }, extractSupportProps(props), { children: _jsx(Editor, Object.assign({}, props, { theme: (theme !== null && theme !== void 0 ? theme : dark) ? 'snackDark' : 'snack', className: cn({ [styles.editor]: hasBackground }), loading: loading !== null && loading !== void 0 ? loading : _jsx(Spinner, {}), options: mergedOptions })) })));
84
89
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.2.1-preview-44f1f327.0",
7
+ "version": "0.2.1-preview-69f7a1cd.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -37,5 +37,5 @@
37
37
  "@snack-uikit/utils": "3.3.0",
38
38
  "classnames": "2.5.1"
39
39
  },
40
- "gitHead": "b199c9710d63b3f8c4f1cf997da36e4caed8337f"
40
+ "gitHead": "54528abded4adf2830a4eb799a0096664ee715de"
41
41
  }
@@ -1,6 +1,6 @@
1
1
  import { Editor, EditorProps, useMonaco } from '@monaco-editor/react';
2
2
  import cn from 'classnames';
3
- import { useMemo } from 'react';
3
+ import { useEffect, useMemo } from 'react';
4
4
 
5
5
  import { Spinner } from '@snack-uikit/loaders';
6
6
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
@@ -111,6 +111,12 @@ export function CodeEditor({
111
111
  [options, themeValues?.mono],
112
112
  );
113
113
 
114
+ useEffect(() => {
115
+ // eslint-disable-next-line no-console
116
+ console.log('!_! remeasureFonts');
117
+ setTimeout(() => monaco?.editor.remeasureFonts(), 0);
118
+ }, [mergedOptions, monaco?.editor]);
119
+
114
120
  return (
115
121
  <div className={className} {...extractSupportProps(props)}>
116
122
  <Editor