@ray-js/code-sandbox 0.0.7-beta-2 → 0.0.7-beta-4

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.
@@ -8,6 +8,7 @@ export interface CodeEditorProps {
8
8
  txpCode: string;
9
9
  baseUri: string;
10
10
  isZhLanguage: boolean;
11
+ style?: React.CSSProperties;
11
12
  }
12
13
  export declare const CodeEditor: React.ForwardRefExoticComponent<CodeEditorProps & React.RefAttributes<{
13
14
  monaco: typeof import("monaco-editor");
@@ -1,4 +1,5 @@
1
- import { Spin } from 'antd';
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { Skeleton } from 'antd';
2
3
  import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
3
4
  import { getComponentResource } from '../../services';
4
5
  import { Editor } from '@saber2pr/monaco';
@@ -15,7 +16,8 @@ export const CodeEditor = /*#__PURE__*/React.forwardRef((_ref, parentRef) => {
15
16
  height,
16
17
  txpCode,
17
18
  baseUri,
18
- isZhLanguage = true
19
+ isZhLanguage = true,
20
+ style
19
21
  } = _ref;
20
22
  const [initloading, setInitLoading] = useState(true);
21
23
  const ref = useRef();
@@ -121,14 +123,19 @@ export const CodeEditor = /*#__PURE__*/React.forwardRef((_ref, parentRef) => {
121
123
  }
122
124
  };
123
125
  }
124
- return /*#__PURE__*/React.createElement(Spin, {
125
- spinning: initloading
126
- }, code && /*#__PURE__*/React.createElement(Editor, {
126
+ if (initloading) {
127
+ return /*#__PURE__*/React.createElement(Skeleton, {
128
+ active: true,
129
+ title: true,
130
+ paragraph: true
131
+ });
132
+ }
133
+ return /*#__PURE__*/React.createElement(React.Fragment, null, code && /*#__PURE__*/React.createElement(Editor, {
127
134
  loaderConfig: loaderConfig,
128
135
  theme: "monokai-bright",
129
- style: {
136
+ style: _objectSpread(_objectSpread({}, style || {}), {}, {
130
137
  height
131
- },
138
+ }),
132
139
  options: {
133
140
  minimap: {
134
141
  enabled: false
@@ -57,6 +57,9 @@ export const CodeSandbox = _ref => {
57
57
  baseUri: baseUri,
58
58
  txpCode: cssCode,
59
59
  height: `calc(90vh - 103px + 48px)`,
60
+ style: {
61
+ flexGrow: 1
62
+ },
60
63
  show: show,
61
64
  title: title,
62
65
  code: code,
@@ -68,6 +71,9 @@ export const CodeSandbox = _ref => {
68
71
  baseUri: baseUri,
69
72
  txpCode: txpCode,
70
73
  height: `calc(90vh - 103px + 48px)`,
74
+ style: {
75
+ flexGrow: 1
76
+ },
71
77
  ref: apiRef,
72
78
  show: show,
73
79
  title: title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/code-sandbox",
3
- "version": "0.0.7-beta-2",
3
+ "version": "0.0.7-beta-4",
4
4
  "description": "小程序 CodeSandbox 容器",
5
5
  "main": "lib/index",
6
6
  "files": [