@blocklet/discuss-kit-ux 2.3.104 → 2.3.106

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,3 +1,5 @@
1
1
  export declare const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
2
2
  export declare const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
3
3
  export declare const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
4
+ export declare const MAX_DISCUSSION_LENGTH: number;
5
+ export declare const MAX_COMMENT_LENGTH: number;
@@ -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 { lazyRetry } from "@arcblock/ux/lib/Util";
7
- import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-BgawtXSC.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-DjHDHSY9.mjs";
8
8
  const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -591,6 +591,20 @@ const useMeasure = () => {
591
591
  const size = useSize(ref);
592
592
  return [ref, size || { width: 0, height: 0 }];
593
593
  };
594
+ const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
595
+ const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
596
+ const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
597
+ const DEFAULT_MAX_DISCUSSION_LENGTH = 25e3;
598
+ const DEFAULT_MAX_COMMENT_LENGTH = 1e4;
599
+ const MAX_POST_LENGTH = 5e4;
600
+ const MAX_DISCUSSION_LENGTH = Math.min(
601
+ Number(window.blocklet.DISCUSS_KIT_MAX_DISCUSSION_LENGTH || DEFAULT_MAX_DISCUSSION_LENGTH),
602
+ MAX_POST_LENGTH
603
+ );
604
+ const MAX_COMMENT_LENGTH = Math.min(
605
+ Number(window.blocklet.DISCUSS_KIT_MAX_COMMENT_LENGTH || DEFAULT_MAX_COMMENT_LENGTH),
606
+ MAX_POST_LENGTH
607
+ );
594
608
  const BlockletEditor$2 = lazyWithPreload(() => import("@blocklet/editor"));
595
609
  const preloadInput = () => BlockletEditor$2.preload();
596
610
  const Input = ({
@@ -646,6 +660,7 @@ const Input = ({
646
660
  setError("");
647
661
  };
648
662
  const submit = async () => {
663
+ var _a3;
649
664
  if (!send) {
650
665
  return;
651
666
  }
@@ -662,7 +677,7 @@ const Input = ({
662
677
  onSuccess == null ? void 0 : onSuccess(result);
663
678
  } catch (e) {
664
679
  setContent(originContent);
665
- setError(e.message);
680
+ setError((e == null ? void 0 : e.status) === 429 ? ((_a3 = e.response) == null ? void 0 : _a3.data) || e.message : e.message);
666
681
  console.error(e);
667
682
  } finally {
668
683
  setLoading(false);
@@ -684,7 +699,7 @@ const Input = ({
684
699
  }
685
700
  },
686
701
  characterLimitConfig: {
687
- maxLength: window.blocklet.preferences.maxCommentLength,
702
+ maxLength: MAX_COMMENT_LENGTH,
688
703
  indicatorStyle: {
689
704
  position: "absolute",
690
705
  bottom: 6,
@@ -1791,9 +1806,6 @@ const useLocaleContext = () => {
1791
1806
  ...rest
1792
1807
  };
1793
1808
  };
1794
- const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
1795
- const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
1796
- const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
1797
1809
  function hashText(text = "") {
1798
1810
  return murmurhash.v3(text).toString(16);
1799
1811
  }
@@ -2012,8 +2024,6 @@ const prefs = window.blocklet.preferences;
2012
2024
  const preferences = {
2013
2025
  ...prefs,
2014
2026
  // 对 preferences 做一些格式化处理
2015
- maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
2016
- maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
2017
2027
  maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
2018
2028
  maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
2019
2029
  assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
@@ -5101,7 +5111,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
5101
5111
  }
5102
5112
  const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", 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" }) });
5103
5113
  const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", 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" }) });
5104
- const Editor = lazyRetry(() => import("./editor-CzWrCuJ6.mjs"));
5114
+ const Editor = lazyRetry(() => import("./editor-w8GSIliM.mjs"));
5105
5115
  function LazyEditor(props) {
5106
5116
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
5107
5117
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -5332,7 +5342,7 @@ function ChatInput({ initialContent, send, onContentChange, onFocusChange }) {
5332
5342
  value: {
5333
5343
  minimalMode: true,
5334
5344
  characterLimitConfig: {
5335
- maxLength: window.blocklet.preferences.maxCommentLength,
5345
+ maxLength: MAX_COMMENT_LENGTH,
5336
5346
  indicatorStyle: { display: "none" }
5337
5347
  }
5338
5348
  },
@@ -6346,7 +6356,7 @@ function DefaultEditorConfigProvider({
6346
6356
  AI,
6347
6357
  templatePlugin,
6348
6358
  characterLimitConfig: {
6349
- maxLength: window.blocklet.preferences.maxDiscussionLength,
6359
+ maxLength: MAX_DISCUSSION_LENGTH,
6350
6360
  indicatorStyle: {
6351
6361
  position: "fixed",
6352
6362
  bottom: 12
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { W, o, Y, aQ, A, n, af, B, G, N, L, O, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-BgawtXSC.mjs";
2
+ import { W, o, Y, aQ, A, n, af, B, G, N, L, O, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-DjHDHSY9.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -508,6 +508,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
508
508
  const size = ahooks.useSize(ref);
509
509
  return [ref, size || { width: 0, height: 0 }];
510
510
  };
511
+ const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
512
+ const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
513
+ const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
514
+ const DEFAULT_MAX_DISCUSSION_LENGTH = 25e3;
515
+ const DEFAULT_MAX_COMMENT_LENGTH = 1e4;
516
+ const MAX_POST_LENGTH = 5e4;
517
+ const MAX_DISCUSSION_LENGTH = Math.min(
518
+ Number(window.blocklet.DISCUSS_KIT_MAX_DISCUSSION_LENGTH || DEFAULT_MAX_DISCUSSION_LENGTH),
519
+ MAX_POST_LENGTH
520
+ );
521
+ const MAX_COMMENT_LENGTH = Math.min(
522
+ Number(window.blocklet.DISCUSS_KIT_MAX_COMMENT_LENGTH || DEFAULT_MAX_COMMENT_LENGTH),
523
+ MAX_POST_LENGTH
524
+ );
511
525
  const BlockletEditor$3 = reactLazyWithPreload.lazyWithPreload(() => import("@blocklet/editor"));
512
526
  const preloadInput = () => BlockletEditor$3.preload();
513
527
  const Input = ({
@@ -563,6 +577,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
563
577
  setError("");
564
578
  };
565
579
  const submit = async () => {
580
+ var _a3;
566
581
  if (!send) {
567
582
  return;
568
583
  }
@@ -579,7 +594,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
579
594
  onSuccess == null ? void 0 : onSuccess(result);
580
595
  } catch (e) {
581
596
  setContent(originContent);
582
- setError(e.message);
597
+ setError((e == null ? void 0 : e.status) === 429 ? ((_a3 = e.response) == null ? void 0 : _a3.data) || e.message : e.message);
583
598
  console.error(e);
584
599
  } finally {
585
600
  setLoading(false);
@@ -601,7 +616,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
601
616
  }
602
617
  },
603
618
  characterLimitConfig: {
604
- maxLength: window.blocklet.preferences.maxCommentLength,
619
+ maxLength: MAX_COMMENT_LENGTH,
605
620
  indicatorStyle: {
606
621
  position: "absolute",
607
622
  bottom: 6,
@@ -1708,9 +1723,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1708
1723
  ...rest
1709
1724
  };
1710
1725
  };
1711
- const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
1712
- const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
1713
- const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
1714
1726
  function hashText(text2 = "") {
1715
1727
  return murmurhash.v3(text2).toString(16);
1716
1728
  }
@@ -1929,8 +1941,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1929
1941
  const preferences = {
1930
1942
  ...prefs,
1931
1943
  // 对 preferences 做一些格式化处理
1932
- maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
1933
- maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
1934
1944
  maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
1935
1945
  maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
1936
1946
  assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
@@ -5249,7 +5259,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5249
5259
  value: {
5250
5260
  minimalMode: true,
5251
5261
  characterLimitConfig: {
5252
- maxLength: window.blocklet.preferences.maxCommentLength,
5262
+ maxLength: MAX_COMMENT_LENGTH,
5253
5263
  indicatorStyle: { display: "none" }
5254
5264
  }
5255
5265
  },
@@ -6263,7 +6273,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6263
6273
  AI,
6264
6274
  templatePlugin,
6265
6275
  characterLimitConfig: {
6266
- maxLength: window.blocklet.preferences.maxDiscussionLength,
6276
+ maxLength: MAX_DISCUSSION_LENGTH,
6267
6277
  indicatorStyle: {
6268
6278
  position: "fixed",
6269
6279
  bottom: 12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.3.104",
3
+ "version": "2.3.106",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -48,8 +48,8 @@
48
48
  "unstated-next": "^1.1.0",
49
49
  "url-join": "^4.0.1",
50
50
  "zustand": "^4.5.5",
51
- "@blocklet/editor": "^2.3.104",
52
- "@blocklet/labels": "^2.3.104"
51
+ "@blocklet/editor": "^2.3.106",
52
+ "@blocklet/labels": "^2.3.106"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@arcblock/did-connect": "^2.10.36",