@blocklet/discuss-kit-ux 2.3.99 → 2.3.101

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.
@@ -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-5yTRBbbn.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-h0-GJ6C8.mjs";
8
8
  const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -682,6 +682,15 @@ const Input = ({
682
682
  toolbar: {
683
683
  items: ["component", "block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
684
684
  }
685
+ },
686
+ characterLimitConfig: {
687
+ maxLength: window.blocklet.preferences.maxCommentLength,
688
+ indicatorStyle: {
689
+ position: "absolute",
690
+ bottom: 6,
691
+ left: { xs: 12, md: 32 }
692
+ },
693
+ alignLeft: false
685
694
  }
686
695
  };
687
696
  const editorState = draftKey && draftContent && !initialContent ? draftContent : inferInitialEditorState(initialContent);
@@ -5092,7 +5101,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
5092
5101
  }
5093
5102
  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" }) });
5094
5103
  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" }) });
5095
- const Editor = lazyRetry(() => import("./editor-varp6jK_.mjs"));
5104
+ const Editor = lazyRetry(() => import("./editor-DzZ4iaEc.mjs"));
5096
5105
  function LazyEditor(props) {
5097
5106
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
5098
5107
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -5317,27 +5326,39 @@ function ChatInput({ initialContent, send, onContentChange, onFocusChange }) {
5317
5326
  children: /* @__PURE__ */ jsx(Box, { component: tablerSend, sx: { fontSize: 13, color: "text.secondary" } })
5318
5327
  }
5319
5328
  ),
5320
- /* @__PURE__ */ jsx(EditorConfigProvider$1, { value: { minimalMode: true }, children: /* @__PURE__ */ jsxs(
5321
- LazyEditor,
5329
+ /* @__PURE__ */ jsx(
5330
+ EditorConfigProvider$1,
5322
5331
  {
5323
- enableSaveAreaPlugin: false,
5324
- initialContent: initialContent || "",
5325
- onChange: ({ content: contentStr, isEmpty }) => {
5326
- const value = isEmpty ? "" : contentStr;
5327
- setContent(value);
5328
- onContentChange == null ? void 0 : onContentChange(value);
5332
+ value: {
5333
+ minimalMode: true,
5334
+ characterLimitConfig: {
5335
+ maxLength: window.blocklet.preferences.maxCommentLength,
5336
+ indicatorStyle: { display: "none" }
5337
+ }
5329
5338
  },
5330
- autoFocus: false,
5331
- placeholder: "Jot something down",
5332
- children: [
5333
- /* @__PURE__ */ jsx(AutoClearPlugin, { clearKey: lastSent }),
5334
- /* @__PURE__ */ jsx(ShortcutPlugin, { callback: handleSend }),
5335
- /* @__PURE__ */ jsx(DraggerPlugin, {}),
5336
- /* @__PURE__ */ jsx(FocusPlugin, { callback: FocusCallback }),
5337
- /* @__PURE__ */ jsx(BusyPlugin, { onChange: (busy) => setEditorBusy(busy) })
5338
- ]
5339
+ children: /* @__PURE__ */ jsxs(
5340
+ LazyEditor,
5341
+ {
5342
+ enableSaveAreaPlugin: false,
5343
+ initialContent: initialContent || "",
5344
+ onChange: ({ content: contentStr, isEmpty }) => {
5345
+ const value = isEmpty ? "" : contentStr;
5346
+ setContent(value);
5347
+ onContentChange == null ? void 0 : onContentChange(value);
5348
+ },
5349
+ autoFocus: false,
5350
+ placeholder: "Jot something down",
5351
+ children: [
5352
+ /* @__PURE__ */ jsx(AutoClearPlugin, { clearKey: lastSent }),
5353
+ /* @__PURE__ */ jsx(ShortcutPlugin, { callback: handleSend }),
5354
+ /* @__PURE__ */ jsx(DraggerPlugin, {}),
5355
+ /* @__PURE__ */ jsx(FocusPlugin, { callback: FocusCallback }),
5356
+ /* @__PURE__ */ jsx(BusyPlugin, { onChange: (busy) => setEditorBusy(busy) })
5357
+ ]
5358
+ }
5359
+ )
5339
5360
  }
5340
- ) })
5361
+ )
5341
5362
  ]
5342
5363
  }
5343
5364
  ),
@@ -6323,7 +6344,15 @@ function DefaultEditorConfigProvider({
6323
6344
  blockletEmbedEndpoint: joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/check"),
6324
6345
  openGraphEndpoint: joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/og"),
6325
6346
  AI,
6326
- templatePlugin
6347
+ templatePlugin,
6348
+ characterLimitConfig: {
6349
+ maxLength: window.blocklet.preferences.maxDiscussionLength,
6350
+ indicatorStyle: {
6351
+ position: "fixed",
6352
+ bottom: 12
6353
+ },
6354
+ alignLeft: true
6355
+ }
6327
6356
  };
6328
6357
  return value;
6329
6358
  }, [isAdmin, request, (_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did, downMd]);
@@ -12739,11 +12768,11 @@ const useTranslate = ({ text, enabled }) => {
12739
12768
  }
12740
12769
  );
12741
12770
  useEffect(() => {
12742
- if (enabled && !isTranslatedRef.current[targetLanguage]) {
12743
- isTranslatedRef.current[targetLanguage] = true;
12771
+ if (enabled && !isTranslatedRef.current[`${targetLanguage}-${key}`]) {
12772
+ isTranslatedRef.current[`${targetLanguage}-${key}`] = true;
12744
12773
  run();
12745
12774
  }
12746
- }, [enabled, run, targetLanguage]);
12775
+ }, [enabled, run, targetLanguage, key]);
12747
12776
  return {
12748
12777
  translation: data,
12749
12778
  key,
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-5yTRBbbn.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-h0-GJ6C8.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -599,6 +599,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
599
599
  toolbar: {
600
600
  items: ["component", "block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
601
601
  }
602
+ },
603
+ characterLimitConfig: {
604
+ maxLength: window.blocklet.preferences.maxCommentLength,
605
+ indicatorStyle: {
606
+ position: "absolute",
607
+ bottom: 6,
608
+ left: { xs: 12, md: 32 }
609
+ },
610
+ alignLeft: false
602
611
  }
603
612
  };
604
613
  const editorState = draftKey && draftContent && !initialContent ? draftContent : inferInitialEditorState(initialContent);
@@ -5234,27 +5243,39 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5234
5243
  children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerSend, sx: { fontSize: 13, color: "text.secondary" } })
5235
5244
  }
5236
5245
  ),
5237
- /* @__PURE__ */ jsxRuntime.jsx(editor$1.EditorConfigProvider, { value: { minimalMode: true }, children: /* @__PURE__ */ jsxRuntime.jsxs(
5238
- LazyEditor,
5246
+ /* @__PURE__ */ jsxRuntime.jsx(
5247
+ editor$1.EditorConfigProvider,
5239
5248
  {
5240
- enableSaveAreaPlugin: false,
5241
- initialContent: initialContent || "",
5242
- onChange: ({ content: contentStr, isEmpty }) => {
5243
- const value = isEmpty ? "" : contentStr;
5244
- setContent(value);
5245
- onContentChange == null ? void 0 : onContentChange(value);
5249
+ value: {
5250
+ minimalMode: true,
5251
+ characterLimitConfig: {
5252
+ maxLength: window.blocklet.preferences.maxCommentLength,
5253
+ indicatorStyle: { display: "none" }
5254
+ }
5246
5255
  },
5247
- autoFocus: false,
5248
- placeholder: "Jot something down",
5249
- children: [
5250
- /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { clearKey: lastSent }),
5251
- /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin, { callback: handleSend }),
5252
- /* @__PURE__ */ jsxRuntime.jsx(DraggerPlugin, {}),
5253
- /* @__PURE__ */ jsxRuntime.jsx(FocusPlugin, { callback: FocusCallback }),
5254
- /* @__PURE__ */ jsxRuntime.jsx(BusyPlugin.BusyPlugin, { onChange: (busy) => setEditorBusy(busy) })
5255
- ]
5256
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
5257
+ LazyEditor,
5258
+ {
5259
+ enableSaveAreaPlugin: false,
5260
+ initialContent: initialContent || "",
5261
+ onChange: ({ content: contentStr, isEmpty }) => {
5262
+ const value = isEmpty ? "" : contentStr;
5263
+ setContent(value);
5264
+ onContentChange == null ? void 0 : onContentChange(value);
5265
+ },
5266
+ autoFocus: false,
5267
+ placeholder: "Jot something down",
5268
+ children: [
5269
+ /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { clearKey: lastSent }),
5270
+ /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin, { callback: handleSend }),
5271
+ /* @__PURE__ */ jsxRuntime.jsx(DraggerPlugin, {}),
5272
+ /* @__PURE__ */ jsxRuntime.jsx(FocusPlugin, { callback: FocusCallback }),
5273
+ /* @__PURE__ */ jsxRuntime.jsx(BusyPlugin.BusyPlugin, { onChange: (busy) => setEditorBusy(busy) })
5274
+ ]
5275
+ }
5276
+ )
5256
5277
  }
5257
- ) })
5278
+ )
5258
5279
  ]
5259
5280
  }
5260
5281
  ),
@@ -6240,7 +6261,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6240
6261
  blockletEmbedEndpoint: ufo.joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/check"),
6241
6262
  openGraphEndpoint: ufo.joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/og"),
6242
6263
  AI,
6243
- templatePlugin
6264
+ templatePlugin,
6265
+ characterLimitConfig: {
6266
+ maxLength: window.blocklet.preferences.maxDiscussionLength,
6267
+ indicatorStyle: {
6268
+ position: "fixed",
6269
+ bottom: 12
6270
+ },
6271
+ alignLeft: true
6272
+ }
6244
6273
  };
6245
6274
  return value;
6246
6275
  }, [isAdmin, request, (_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did, downMd]);
@@ -12656,11 +12685,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
12656
12685
  }
12657
12686
  );
12658
12687
  react.useEffect(() => {
12659
- if (enabled && !isTranslatedRef.current[targetLanguage]) {
12660
- isTranslatedRef.current[targetLanguage] = true;
12688
+ if (enabled && !isTranslatedRef.current[`${targetLanguage}-${key}`]) {
12689
+ isTranslatedRef.current[`${targetLanguage}-${key}`] = true;
12661
12690
  run();
12662
12691
  }
12663
- }, [enabled, run, targetLanguage]);
12692
+ }, [enabled, run, targetLanguage, key]);
12664
12693
  return {
12665
12694
  translation: data,
12666
12695
  key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.3.99",
3
+ "version": "2.3.101",
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.99",
52
- "@blocklet/labels": "^2.3.99"
51
+ "@blocklet/editor": "^2.3.101",
52
+ "@blocklet/labels": "^2.3.101"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@arcblock/did-connect": "^2.10.36",