@fe-free/core 2.8.11 → 2.8.12

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 2.8.12
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: error
8
+ - @fe-free/tool@2.8.12
9
+
3
10
  ## 2.8.11
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "2.8.11",
3
+ "version": "2.8.12",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -30,7 +30,6 @@
30
30
  "classnames": "^2.5.1",
31
31
  "file-saver": "^2.0.5",
32
32
  "github-markdown-css": "^5.8.1",
33
- "i": "^0.3.7",
34
33
  "localforage": "^1.10.0",
35
34
  "lodash-es": "^4.17.21",
36
35
  "react-ace": "^11.0.1",
@@ -42,7 +41,7 @@
42
41
  "safe-stable-stringify": "^2.5.0",
43
42
  "vanilla-jsoneditor": "^0.23.1",
44
43
  "zustand": "^4.5.4",
45
- "@fe-free/tool": "2.8.11"
44
+ "@fe-free/tool": "2.8.12"
46
45
  },
47
46
  "peerDependencies": {
48
47
  "@ant-design/pro-components": "2.8.9",
@@ -90,10 +90,10 @@ for i in range(10):
90
90
  render: (props) => <BasicDemo {...props} />,
91
91
  };
92
92
 
93
- export const JSON: Story = {
93
+ export const ForJSON: Story = {
94
94
  args: {
95
95
  language: 'json',
96
- value: '{"action": "hello", "data": "world"}',
96
+ value: JSON.stringify({ action: 'hello', data: 'world' }, null, 2),
97
97
  },
98
98
  render: (props) => <BasicDemo {...props} />,
99
99
  };
@@ -71,10 +71,14 @@ function commonHandleError(event) {
71
71
  // unknown error
72
72
  }
73
73
 
74
- function initErrorHandle(onError) {
74
+ function initErrorHandle(onError?: (event: ErrorEvent | PromiseRejectionEvent) => void | false) {
75
75
  const handleError = (event) => {
76
+ const result = onError?.(event);
77
+ if (result === false) {
78
+ return;
79
+ }
80
+
76
81
  commonHandleError(event);
77
- onError?.(event);
78
82
  };
79
83
 
80
84
  window.addEventListener('error', handleError);