@blocklet/discuss-kit-ux 2.0.97 → 2.0.99

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.
@@ -19,3 +19,5 @@ export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<T
19
19
  export declare const discussKitMountPoint: string | undefined;
20
20
  export declare const isInDiscussKitApp: boolean | "" | undefined;
21
21
  export declare const openProfile: (did: string, newTab?: boolean) => void;
22
+ export declare const randomId: () => string;
23
+ export declare const getDiscussKitClientId: () => string;
@@ -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-Caco31R0.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-CEddDr2z.mjs";
8
8
  const BlockletEditor = lazy(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -349,12 +349,23 @@ const openProfile = (did, newTab) => {
349
349
  window.open(withQuery(joinURL(discussKitMountPoint || "/", "profile"), { did }), newTab ? "_blank" : "_self");
350
350
  }
351
351
  };
352
+ const randomId = () => {
353
+ var _a2;
354
+ return ((_a2 = crypto == null ? void 0 : crypto.randomUUID) == null ? void 0 : _a2.call(crypto)) || Math.random().toString(36).substring(2);
355
+ };
356
+ const getDiscussKitClientId = () => {
357
+ if (!window.__discuss_kit_client_id__) {
358
+ window.__discuss_kit_client_id__ = randomId();
359
+ }
360
+ return window.__discuss_kit_client_id__;
361
+ };
352
362
  const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
353
363
  __proto__: null,
354
364
  blockletExists,
355
365
  copy,
356
366
  discussKitMountPoint,
357
367
  getBlockletMountPointInfo,
368
+ getDiscussKitClientId,
358
369
  getDraftSessionKeyPrefix,
359
370
  getExcerptFromLexicalContent,
360
371
  getLastItem,
@@ -366,6 +377,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
366
377
  minDelay,
367
378
  openProfile,
368
379
  protectLogin,
380
+ randomId,
369
381
  repairBase64Avatar,
370
382
  sleep,
371
383
  tryParseJSONObject
@@ -2218,10 +2230,12 @@ function GithubReaction({
2218
2230
  const prefs = window.blocklet.preferences;
2219
2231
  const preferences = {
2220
2232
  ...prefs,
2221
- maxCommentLength: parseInt(prefs.maxCommentLength, 10),
2222
- maxDiscussionLength: parseInt(prefs.maxDiscussionLength, 10),
2223
- maxPinLimit: parseInt(prefs.maxPinLimit, 10),
2224
- maxFeaturedLimit: parseInt(prefs.maxFeaturedLimit, 10)
2233
+ // preferences 做一些格式化处理
2234
+ maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
2235
+ maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
2236
+ maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
2237
+ maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
2238
+ assignmentAuthorizedPassports: prefs.assignmentAuthorizedPassports.split(",").map((x) => x.trim())
2225
2239
  };
2226
2240
  function Confirm({
2227
2241
  open,
@@ -4760,7 +4774,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
4760
4774
  }
4761
4775
  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" }) });
4762
4776
  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" }) });
4763
- const Editor = lazy(() => import("./editor-ksxz55jz.mjs"));
4777
+ const Editor = lazy(() => import("./editor-xTxzS1UN.mjs"));
4764
4778
  function LazyEditor(props) {
4765
4779
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
4766
4780
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -11991,10 +12005,16 @@ function PointUpProvider({ children }) {
11991
12005
  state.visible = false;
11992
12006
  }
11993
12007
  }, [JSON.stringify(state.pointsList)]);
11994
- useSubscription((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did, ({ event, data }) => {
11995
- var _a3;
11996
- return (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
11997
- }, []);
12008
+ useSubscription(
12009
+ (_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did,
12010
+ ({ event, clientId, data }) => {
12011
+ var _a3;
12012
+ if (clientId === getDiscussKitClientId()) {
12013
+ (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
12014
+ }
12015
+ },
12016
+ []
12017
+ );
11998
12018
  return /* @__PURE__ */ jsxs(PointUpContext.Provider, { value, children: [
11999
12019
  (pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) && createPortal(
12000
12020
  /* @__PURE__ */ jsx(
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-Caco31R0.mjs";
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-CEddDr2z.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -275,12 +275,23 @@ var __publicField = (obj, key, value) => {
275
275
  window.open(ufo.withQuery(ufo.joinURL(discussKitMountPoint || "/", "profile"), { did }), newTab ? "_blank" : "_self");
276
276
  }
277
277
  };
278
+ const randomId = () => {
279
+ var _a2;
280
+ return ((_a2 = crypto == null ? void 0 : crypto.randomUUID) == null ? void 0 : _a2.call(crypto)) || Math.random().toString(36).substring(2);
281
+ };
282
+ const getDiscussKitClientId = () => {
283
+ if (!window.__discuss_kit_client_id__) {
284
+ window.__discuss_kit_client_id__ = randomId();
285
+ }
286
+ return window.__discuss_kit_client_id__;
287
+ };
278
288
  const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
279
289
  __proto__: null,
280
290
  blockletExists,
281
291
  copy,
282
292
  discussKitMountPoint,
283
293
  getBlockletMountPointInfo,
294
+ getDiscussKitClientId,
284
295
  getDraftSessionKeyPrefix,
285
296
  getExcerptFromLexicalContent,
286
297
  getLastItem,
@@ -292,6 +303,7 @@ var __publicField = (obj, key, value) => {
292
303
  minDelay,
293
304
  openProfile,
294
305
  protectLogin,
306
+ randomId,
295
307
  repairBase64Avatar,
296
308
  sleep,
297
309
  tryParseJSONObject
@@ -2144,10 +2156,12 @@ var __publicField = (obj, key, value) => {
2144
2156
  const prefs = window.blocklet.preferences;
2145
2157
  const preferences = {
2146
2158
  ...prefs,
2147
- maxCommentLength: parseInt(prefs.maxCommentLength, 10),
2148
- maxDiscussionLength: parseInt(prefs.maxDiscussionLength, 10),
2149
- maxPinLimit: parseInt(prefs.maxPinLimit, 10),
2150
- maxFeaturedLimit: parseInt(prefs.maxFeaturedLimit, 10)
2159
+ // preferences 做一些格式化处理
2160
+ maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
2161
+ maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
2162
+ maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
2163
+ maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
2164
+ assignmentAuthorizedPassports: prefs.assignmentAuthorizedPassports.split(",").map((x) => x.trim())
2151
2165
  };
2152
2166
  function Confirm({
2153
2167
  open,
@@ -11917,10 +11931,16 @@ var __publicField = (obj, key, value) => {
11917
11931
  state.visible = false;
11918
11932
  }
11919
11933
  }, [JSON.stringify(state.pointsList)]);
11920
- useSubscription((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did, ({ event, data }) => {
11921
- var _a3;
11922
- return (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
11923
- }, []);
11934
+ useSubscription(
11935
+ (_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did,
11936
+ ({ event, clientId, data }) => {
11937
+ var _a3;
11938
+ if (clientId === getDiscussKitClientId()) {
11939
+ (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
11940
+ }
11941
+ },
11942
+ []
11943
+ );
11924
11944
  return /* @__PURE__ */ jsxRuntime.jsxs(PointUpContext.Provider, { value, children: [
11925
11945
  (pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) && ReactDOM.createPortal(
11926
11946
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1,82 +1,2 @@
1
- declare const preferences: {
2
- maxCommentLength: number;
3
- maxDiscussionLength: number;
4
- maxPinLimit: number;
5
- maxFeaturedLimit: number;
6
- allowDeleteComment: boolean;
7
- allowEditComment: boolean;
8
- allowImageComment: boolean;
9
- discussMode: "knowledge-base" | "BBS";
10
- postsViewMode: "flat" | "nested";
11
- allowDeleteDiscussion: boolean;
12
- allowEditDiscussion: boolean;
13
- allowNewDiscussion: boolean;
14
- allowLockDiscussion: boolean;
15
- allowPublishBlog: boolean;
16
- displayBlogComments: boolean;
17
- displayLabelFilterOnBlogList: boolean;
18
- blogListStyle: "default";
19
- displayAuthorOnBlogList: boolean;
20
- displayLabelsOnBlogList: boolean;
21
- displayAuthorOnBlog: boolean;
22
- displayLabelsOnBlog: boolean;
23
- displayBackButtonOnBlog: boolean;
24
- displayConnectButtonOnBlog: boolean;
25
- displayReactionOnBlog: boolean;
26
- displayReplyButtonForAnonymousUsers: boolean;
27
- disableNotificationBadge: boolean;
28
- enableDiscussLog: boolean;
29
- discussLogPosition: "top" | "standard";
30
- enableDiscussPostLog: boolean;
31
- enableDiscussCommentLog: boolean;
32
- enableBlogLog: boolean;
33
- blogLogPosition: "top" | "standard";
34
- enableBlogPostLog: boolean;
35
- enableBlogCommentLog: boolean;
36
- enableDocsLog: boolean;
37
- docsLogPosition: "top" | "standard";
38
- enableDocsPostLog: boolean;
39
- enableDocsCommentLog: boolean;
40
- badgeList: any[];
41
- socialShareButtonsDiscussion: boolean;
42
- socialShareButtonsBlog: boolean;
43
- socialShareButtonsDoc: boolean;
44
- blogListTemplate: "standard" | "corp";
45
- blogTemplate: "standard" | "corp";
46
- primaryColor: string;
47
- secondaryColor: string;
48
- subscriptionPublicType: "blur" | "slice";
49
- enableAssignmentDiscussion: boolean;
50
- enableAssignmentBlog: boolean;
51
- enableAssignmentDoc: boolean;
52
- bannerTitleDiscussionEn: string;
53
- bannerTitleDiscussionZh: string;
54
- bannerDescDiscussionEn: string;
55
- bannerDescDiscussionZh: string;
56
- bannerTitleBlogEn: string;
57
- bannerTitleBlogZh: string;
58
- bannerDescBlogEn: string;
59
- bannerDescBlogZh: string;
60
- bannerTitleDocEn: string;
61
- bannerTitleDocZh: string;
62
- bannerDescDocEn: string;
63
- bannerDescDocZh: string;
64
- bannerTitleBookmarkEn: string;
65
- bannerTitleBookmarkZh: string;
66
- bannerDescBookmarkEn: string;
67
- bannerDescBookmarkZh: string;
68
- discussionsVisiblePostTypes: string[];
69
- allowDonationOnDiscussion: boolean;
70
- allowDonationAmountCustom: boolean;
71
- discussionDonationButtonText: string;
72
- discussionDonationHistoryStyle: string;
73
- discussionDonationMaximum: string;
74
- discussionDonationMinimum: string;
75
- discussionDonationPresets: string;
76
- discussionEnabled: boolean;
77
- blogEnabled: boolean;
78
- docEnabled: boolean;
79
- bookmarkEnabled: boolean;
80
- chatEnabled: boolean;
81
- };
1
+ declare const preferences: typeof window.blocklet.preferences;
82
2
  export default preferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.0.97",
3
+ "version": "2.0.99",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -31,8 +31,8 @@
31
31
  "@arcblock/bridge": "^2.10.12",
32
32
  "@arcblock/react-hooks": "^2.10.12",
33
33
  "@arcblock/ws": "^1.18.128",
34
- "@blocklet/editor": "2.0.97",
35
- "@blocklet/labels": "2.0.97",
34
+ "@blocklet/editor": "2.0.99",
35
+ "@blocklet/labels": "2.0.99",
36
36
  "@blocklet/uploader": "^0.1.20",
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": "30e084256218be145f334a501278e421735565ce"
103
+ "gitHead": "9cf729989456de5f3b22b0d9936250d9a072780c"
104
104
  }