@ray-js/code-sandbox 0.0.7-beta-11 → 0.0.7-beta-13
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.
|
@@ -35,8 +35,10 @@ export interface UseCodeSandboxDrawerOps {
|
|
|
35
35
|
cssCode?: string;
|
|
36
36
|
styMap?: any;
|
|
37
37
|
cssParse?: (css: string) => Promise<string>;
|
|
38
|
+
noTypeInit?: boolean;
|
|
39
|
+
extra?: React.ReactNode;
|
|
38
40
|
}
|
|
39
|
-
export declare const useCodeSandboxDrawer: ({ getContainer, title, height, placement, isZhLanguage, pageName, txpCode, emptyText, langKey, baseUri, code, editorApi, cssCode, styMap, cssParse, }: UseCodeSandboxDrawerOps) => {
|
|
41
|
+
export declare const useCodeSandboxDrawer: ({ getContainer, title, height, placement, isZhLanguage, pageName, txpCode, emptyText, langKey, baseUri, code, editorApi, cssCode, styMap, cssParse, noTypeInit, extra, }: UseCodeSandboxDrawerOps) => {
|
|
40
42
|
modal: React.JSX.Element;
|
|
41
43
|
show: boolean;
|
|
42
44
|
setShow: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -57,4 +59,5 @@ export declare const CodeSandboxButton: React.FC<{
|
|
|
57
59
|
styMap?: any;
|
|
58
60
|
noTypeInit?: boolean;
|
|
59
61
|
cssParse?: (css: string) => Promise<string>;
|
|
62
|
+
extra?: React.ReactNode;
|
|
60
63
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["tooltip", "buttonProps"];
|
|
4
|
+
const _excluded = ["tooltip", "buttonProps", "extra"];
|
|
5
5
|
/* eslint-disable react/self-closing-comp */
|
|
6
6
|
import { Button, Drawer, Tooltip } from 'antd';
|
|
7
7
|
import _ from 'lodash';
|
|
@@ -137,7 +137,9 @@ export const useCodeSandboxDrawer = _ref2 => {
|
|
|
137
137
|
editorApi,
|
|
138
138
|
cssCode,
|
|
139
139
|
styMap,
|
|
140
|
-
cssParse
|
|
140
|
+
cssParse,
|
|
141
|
+
noTypeInit,
|
|
142
|
+
extra
|
|
141
143
|
} = _ref2;
|
|
142
144
|
const [show, setShow] = useState(false);
|
|
143
145
|
return {
|
|
@@ -151,6 +153,7 @@ export const useCodeSandboxDrawer = _ref2 => {
|
|
|
151
153
|
style: {
|
|
152
154
|
padding: 0
|
|
153
155
|
},
|
|
156
|
+
extra: extra,
|
|
154
157
|
placement: placement,
|
|
155
158
|
destroyOnClose: true,
|
|
156
159
|
open: show,
|
|
@@ -158,6 +161,7 @@ export const useCodeSandboxDrawer = _ref2 => {
|
|
|
158
161
|
setShow(false);
|
|
159
162
|
}
|
|
160
163
|
}, /*#__PURE__*/React.createElement(CodeSandbox, {
|
|
164
|
+
noTypeInit: noTypeInit,
|
|
161
165
|
editorApi: editorApi,
|
|
162
166
|
isZhLanguage: isZhLanguage,
|
|
163
167
|
emptyText: emptyText,
|
|
@@ -179,12 +183,14 @@ export const useCodeSandboxDrawer = _ref2 => {
|
|
|
179
183
|
export const CodeSandboxButton = _ref3 => {
|
|
180
184
|
let {
|
|
181
185
|
tooltip,
|
|
182
|
-
buttonProps
|
|
186
|
+
buttonProps,
|
|
187
|
+
extra
|
|
183
188
|
} = _ref3,
|
|
184
189
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
185
190
|
const api = useCodeSandboxDrawer(_objectSpread(_objectSpread({}, props), {}, {
|
|
186
191
|
height: '90vh',
|
|
187
|
-
getContainer: () => ref.current
|
|
192
|
+
getContainer: () => ref.current,
|
|
193
|
+
extra
|
|
188
194
|
}));
|
|
189
195
|
const ref = useRef();
|
|
190
196
|
return /*#__PURE__*/React.createElement(DrawerContain, {
|