@blocklet/discuss-kit-ux 2.0.98 → 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-8LMyNkyB.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
@@ -4762,7 +4774,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
4762
4774
  }
4763
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" }) });
4764
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" }) });
4765
- const Editor = lazy(() => import("./editor-DYjHI-qS.mjs"));
4777
+ const Editor = lazy(() => import("./editor-xTxzS1UN.mjs"));
4766
4778
  function LazyEditor(props) {
4767
4779
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
4768
4780
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -11993,10 +12005,16 @@ function PointUpProvider({ children }) {
11993
12005
  state.visible = false;
11994
12006
  }
11995
12007
  }, [JSON.stringify(state.pointsList)]);
11996
- useSubscription((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did, ({ event, data }) => {
11997
- var _a3;
11998
- return (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
11999
- }, []);
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
+ );
12000
12018
  return /* @__PURE__ */ jsxs(PointUpContext.Provider, { value, children: [
12001
12019
  (pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) && createPortal(
12002
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-8LMyNkyB.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
@@ -11919,10 +11931,16 @@ var __publicField = (obj, key, value) => {
11919
11931
  state.visible = false;
11920
11932
  }
11921
11933
  }, [JSON.stringify(state.pointsList)]);
11922
- useSubscription((_d = session == null ? void 0 : session.user) == null ? void 0 : _d.did, ({ event, data }) => {
11923
- var _a3;
11924
- return (_a3 = handlers[event]) == null ? void 0 : _a3.call(handlers, data);
11925
- }, []);
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
+ );
11926
11944
  return /* @__PURE__ */ jsxRuntime.jsxs(PointUpContext.Provider, { value, children: [
11927
11945
  (pointUpComponent == null ? void 0 : pointUpComponent.mountPoint) && ReactDOM.createPortal(
11928
11946
  /* @__PURE__ */ jsxRuntime.jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.0.98",
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.98",
35
- "@blocklet/labels": "2.0.98",
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": "48f5be0c9040037f11ba939b63b4d78dab0ea220"
103
+ "gitHead": "9cf729989456de5f3b22b0d9936250d9a072780c"
104
104
  }