@antv/dumi-theme-antv 0.3.0-beta.6 → 0.3.0-beta.7
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.
|
@@ -86,12 +86,15 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
86
86
|
window.dispatchEvent(e);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
var reportError = useCallback(function (e) {
|
|
89
|
+
var reportError = useCallback(debounce(function (e) {
|
|
90
90
|
if (e) {
|
|
91
91
|
console.error(e);
|
|
92
92
|
onError(e);
|
|
93
|
+
e && e.preventDefault && e.preventDefault();
|
|
94
|
+
} else {
|
|
95
|
+
onError(null);
|
|
93
96
|
}
|
|
94
|
-
}, []);
|
|
97
|
+
}, 50), []);
|
|
95
98
|
useEffect(function () {
|
|
96
99
|
// 用于上报错误信息,使用 script 执行代码
|
|
97
100
|
if (typeof window !== 'undefined') {
|
|
@@ -119,10 +122,9 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
119
122
|
try {
|
|
120
123
|
compiled = compile(replaceInsertCss(v, locale.id), relativePath); // 清除错误
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
reportError(null);
|
|
123
126
|
} catch (e) {
|
|
124
|
-
|
|
125
|
-
onError(e); // 执行出错,后面的步骤不用做了!
|
|
127
|
+
reportError(e); // 执行出错,后面的步骤不用做了!
|
|
126
128
|
|
|
127
129
|
return;
|
|
128
130
|
} // 2. 执行代码,try catch 在内部已经做了
|