@blocklet/discuss-kit-ux 2.0.36 → 2.0.37
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,7 +1,8 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
1
|
+
import { AxiosError, AxiosInstance } from 'axios';
|
|
2
2
|
|
|
3
3
|
interface Options {
|
|
4
4
|
request: AxiosInstance;
|
|
5
|
+
onError?: (error: AxiosError) => boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const useDefaultApiErrorHandler: (options: Options) => void;
|
|
7
8
|
export declare const DefaultApiErrorHandler: ({ request }: Options) => null;
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazy } from "react";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-DNGAJiEk.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -4717,7 +4717,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4717
4717
|
}
|
|
4718
4718
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
4719
4719
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
4720
|
-
const Editor = lazy(() => import("./editor-
|
|
4720
|
+
const Editor = lazy(() => import("./editor-DJ8e2ACp.mjs"));
|
|
4721
4721
|
function LazyEditor(props) {
|
|
4722
4722
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4723
4723
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5787,7 +5787,7 @@ const useApiErrorHandler = ({ request, errorHandler }) => {
|
|
|
5787
5787
|
}, []);
|
|
5788
5788
|
};
|
|
5789
5789
|
const useDefaultApiErrorHandler = (options) => {
|
|
5790
|
-
const { request } = options;
|
|
5790
|
+
const { request, onError } = options;
|
|
5791
5791
|
const { t } = useLocaleContext();
|
|
5792
5792
|
const showError = (msg, toastOptions) => {
|
|
5793
5793
|
Toast.error(msg, { preventDuplicate: true, ...toastOptions });
|
|
@@ -5797,6 +5797,9 @@ const useDefaultApiErrorHandler = (options) => {
|
|
|
5797
5797
|
};
|
|
5798
5798
|
const errorHandler = {
|
|
5799
5799
|
handleError(error) {
|
|
5800
|
+
if (onError && onError(error)) {
|
|
5801
|
+
return;
|
|
5802
|
+
}
|
|
5800
5803
|
if (error.code === AxiosError.ETIMEDOUT || error.code === AxiosError.ECONNABORTED) {
|
|
5801
5804
|
showError(t("apiError.timeout"));
|
|
5802
5805
|
return;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-
|
|
2
|
+
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-DNGAJiEk.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -5713,7 +5713,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5713
5713
|
}, []);
|
|
5714
5714
|
};
|
|
5715
5715
|
const useDefaultApiErrorHandler = (options) => {
|
|
5716
|
-
const { request } = options;
|
|
5716
|
+
const { request, onError } = options;
|
|
5717
5717
|
const { t } = context.useLocaleContext();
|
|
5718
5718
|
const showError = (msg, toastOptions) => {
|
|
5719
5719
|
Toast.error(msg, { preventDuplicate: true, ...toastOptions });
|
|
@@ -5723,6 +5723,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5723
5723
|
};
|
|
5724
5724
|
const errorHandler = {
|
|
5725
5725
|
handleError(error) {
|
|
5726
|
+
if (onError && onError(error)) {
|
|
5727
|
+
return;
|
|
5728
|
+
}
|
|
5726
5729
|
if (error.code === axios.AxiosError.ETIMEDOUT || error.code === axios.AxiosError.ECONNABORTED) {
|
|
5727
5730
|
showError(t("apiError.timeout"));
|
|
5728
5731
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.37",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@arcblock/bridge": "^2.10.1",
|
|
32
32
|
"@arcblock/react-hooks": "^2.10.1",
|
|
33
33
|
"@arcblock/ws": "^1.18.123",
|
|
34
|
-
"@blocklet/editor": "2.0.
|
|
35
|
-
"@blocklet/labels": "2.0.
|
|
34
|
+
"@blocklet/editor": "2.0.37",
|
|
35
|
+
"@blocklet/labels": "2.0.37",
|
|
36
36
|
"@blocklet/uploader": "^0.1.15",
|
|
37
37
|
"@emotion/css": "^11.10.5",
|
|
38
38
|
"@emotion/react": "^11.10.5",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"resolutions": {
|
|
101
101
|
"react": "^18.2.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "7739c4309ff2a2997bd1f5f5d3510ec0c291dabd"
|
|
104
104
|
}
|