@antv/dumi-theme-antv 0.7.7 → 0.7.8

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.
@@ -64,8 +64,11 @@ var CodeEditor = function CodeEditor(_ref) {
64
64
  es5 = _themeConfig$es === void 0 ? true : _themeConfig$es,
65
65
  _themeConfig$showSpec = themeConfig.showSpecTab,
66
66
  showSpecTab = _themeConfig$showSpec === void 0 ? false : _themeConfig$showSpec;
67
- var _themeConfig$playgrou = themeConfig.playground.extraLib,
68
- extraLib = _themeConfig$playgrou === void 0 ? '' : _themeConfig$playgrou;
67
+ var _themeConfig$playgrou = themeConfig.playground,
68
+ _themeConfig$playgrou2 = _themeConfig$playgrou.extraLib,
69
+ extraLib = _themeConfig$playgrou2 === void 0 ? '' : _themeConfig$playgrou2,
70
+ _themeConfig$playgrou3 = _themeConfig$playgrou.playgroundBeforeExecute,
71
+ playgroundBeforeExecute = _themeConfig$playgrou3 === void 0 ? '' : _themeConfig$playgrou3;
69
72
  // 编辑器两个 tab,分别是代码和数据
70
73
  var _useState = useState(null),
71
74
  _useState2 = _slicedToArray(_useState, 2),
@@ -132,6 +135,13 @@ var CodeEditor = function CodeEditor(_ref) {
132
135
  };
133
136
  }, []);
134
137
  var executeCode = useCallback(debounce(function (v) {
138
+ try {
139
+ var playgroundBeforeExecuteFunction = new Function('containerId', playgroundBeforeExecute);
140
+ playgroundBeforeExecuteFunction(containerId);
141
+ } catch (e) {
142
+ reportError(e);
143
+ // 执行出错,不影响后面流程
144
+ }
135
145
  if (currentEditorTab !== EDITOR_TABS.JAVASCRIPT) return;
136
146
  if (!v) return;
137
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "keywords": [
6
6
  "dumi",
@@ -20,6 +20,17 @@
20
20
  "files": [
21
21
  "dist"
22
22
  ],
23
+ "scripts": {
24
+ "build": "npm run prepare && father build",
25
+ "dev": "father dev",
26
+ "fix": "prettier ./src --write",
27
+ "lint": "npm run lint:es && npm run lint:css",
28
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
29
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
30
+ "prepare": "father link-dev-theme",
31
+ "prepublishOnly": "npm run build",
32
+ "start": "cd example && npm run dev"
33
+ },
23
34
  "commitlint": {
24
35
  "extends": [
25
36
  "@commitlint/config-conventional"
@@ -150,14 +161,5 @@
150
161
  "authors": [
151
162
  "dumi",
152
163
  "antv"
153
- ],
154
- "scripts": {
155
- "build": "npm run prepare && father build",
156
- "dev": "father dev",
157
- "fix": "prettier ./src --write",
158
- "lint": "npm run lint:es && npm run lint:css",
159
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
160
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
161
- "start": "cd example && npm run dev"
162
- }
163
- }
164
+ ]
165
+ }