@ray-js/code-sandbox 0.0.7-beta-13 → 0.0.7-beta-15

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,4 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /* eslint-disable no-await-in-loop */
2
3
  import { Skeleton } from 'antd';
3
4
  import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
4
5
  import { getComponentResource } from '../../services';
@@ -107,22 +108,16 @@ export const CodeEditor = /*#__PURE__*/React.forwardRef((_ref, parentRef) => {
107
108
  };
108
109
  }, [show, fileName]);
109
110
  useEffect(() => {
110
- const destroyOnClose = () => {
111
+ return () => {
111
112
  const api = ref.current;
112
- if (!show) {
113
- if (api) {
114
- const model = api.getModel();
115
- if (model) {
116
- model.dispose();
117
- }
113
+ if (api) {
114
+ const model = api.getModel();
115
+ if (model) {
116
+ model.dispose();
118
117
  }
119
118
  }
120
119
  };
121
- destroyOnClose();
122
- return () => {
123
- destroyOnClose();
124
- };
125
- }, [show]);
120
+ }, []);
126
121
  useImperativeHandle(parentRef, () => ref.current);
127
122
  const loaderConfig = {
128
123
  paths: {
@@ -88,7 +88,11 @@ export const CodeSandbox = _ref => {
88
88
  onChange: newCode => {
89
89
  postCode(newCode);
90
90
  }
91
- }))) : /*#__PURE__*/React.createElement(CodeEditor, {
91
+ }))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MainHeader, null, /*#__PURE__*/React.createElement(MainHeaderItem, {
92
+ style: {
93
+ width: '100%'
94
+ }
95
+ }, "Js Code")), /*#__PURE__*/React.createElement(MainContent, null, /*#__PURE__*/React.createElement(CodeEditor, {
92
96
  isZhLanguage: isZhLanguage,
93
97
  baseUri: baseUri,
94
98
  noTypeInit: noTypeInit,
@@ -96,12 +100,15 @@ export const CodeSandbox = _ref => {
96
100
  height: "calc(90vh - 103px + 48px)",
97
101
  ref: apiRef,
98
102
  show: show,
103
+ style: {
104
+ width: '100%'
105
+ },
99
106
  title: title,
100
107
  code: code,
101
108
  onChange: newCode => {
102
109
  postCode(newCode);
103
110
  }
104
- })), pageName && /*#__PURE__*/React.createElement(Right, null, /*#__PURE__*/React.createElement(Demo, {
111
+ })))), pageName && /*#__PURE__*/React.createElement(Right, null, /*#__PURE__*/React.createElement(Demo, {
105
112
  emptyText: emptyText,
106
113
  langKey: langKey,
107
114
  baseUri: baseUri,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/code-sandbox",
3
- "version": "0.0.7-beta-13",
3
+ "version": "0.0.7-beta-15",
4
4
  "description": "小程序 CodeSandbox 容器",
5
5
  "main": "lib/index",
6
6
  "files": [