@blocklet/discuss-kit-ux 2.0.41 → 2.0.43

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.
@@ -17,6 +17,7 @@ interface Session {
17
17
  }
18
18
  export declare const useSessionContext: () => {
19
19
  isAdmin: boolean;
20
+ isMember: boolean;
20
21
  hasAnyPassport: (passports: string | string[]) => boolean;
21
22
  hasAnyPermission: (perms: string | string[]) => boolean;
22
23
  session: Session;
@@ -7,5 +7,6 @@ export interface CommentProps {
7
7
  onUnrate: CommentAPI['unrate'];
8
8
  onReply: CommentAPI['reply'];
9
9
  onLoadMoreReplies: (rootId: string) => void;
10
+ actions?: React.ReactNode;
10
11
  }
11
- export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, actions, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
@@ -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-CuCLDEJk.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-DO14VdHH.mjs";
8
8
  const BlockletEditor = lazy(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -1050,6 +1050,7 @@ const useSessionContext = () => {
1050
1050
  return {
1051
1051
  ...ctx,
1052
1052
  isAdmin: ["admin", "owner"].includes(loginRole),
1053
+ isMember: ["member"].includes(loginRole),
1053
1054
  hasAnyPassport: (passports) => {
1054
1055
  if (!passports || passports.length === 0) {
1055
1056
  return true;
@@ -2307,6 +2308,7 @@ function Comment({
2307
2308
  onReply,
2308
2309
  onContentUpdate,
2309
2310
  onLoadMoreReplies,
2311
+ actions,
2310
2312
  ...rest
2311
2313
  }) {
2312
2314
  const { session } = useSessionContext();
@@ -2333,40 +2335,43 @@ function Comment({
2333
2335
  };
2334
2336
  const render = ({ post, interactive }) => {
2335
2337
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2336
- /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsx(
2337
- GithubReaction,
2338
- {
2339
- data: (post == null ? void 0 : post.rating) || [],
2340
- onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2341
- onUnrate: () => onUnrate(post),
2342
- interactive,
2343
- append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
2344
- Box$1,
2345
- {
2346
- onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
2347
- sx: {
2348
- display: "flex",
2349
- alignItems: "center",
2350
- gap: 0.75,
2351
- fontSize: 13,
2352
- color: "text.secondary",
2353
- lineHeight: 1,
2354
- "&:hover": { cursor: "pointer" }
2355
- },
2356
- children: [
2357
- /* @__PURE__ */ jsx(
2358
- Box$1,
2359
- {
2360
- component: tablerMessageCircle,
2361
- sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2362
- }
2363
- ),
2364
- /* @__PURE__ */ jsx(Box$1, { component: "span", children: "Reply" })
2365
- ]
2366
- }
2367
- )
2368
- }
2369
- ) }),
2338
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: [
2339
+ /* @__PURE__ */ jsx(
2340
+ GithubReaction,
2341
+ {
2342
+ data: (post == null ? void 0 : post.rating) || [],
2343
+ onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2344
+ onUnrate: () => onUnrate(post),
2345
+ interactive,
2346
+ append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
2347
+ Box$1,
2348
+ {
2349
+ onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
2350
+ sx: {
2351
+ display: "flex",
2352
+ alignItems: "center",
2353
+ gap: 0.75,
2354
+ fontSize: 13,
2355
+ color: "text.secondary",
2356
+ lineHeight: 1,
2357
+ "&:hover": { cursor: "pointer" }
2358
+ },
2359
+ children: [
2360
+ /* @__PURE__ */ jsx(
2361
+ Box$1,
2362
+ {
2363
+ component: tablerMessageCircle,
2364
+ sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2365
+ }
2366
+ ),
2367
+ /* @__PURE__ */ jsx(Box$1, { component: "span", children: "Reply" })
2368
+ ]
2369
+ }
2370
+ )
2371
+ }
2372
+ ),
2373
+ actions
2374
+ ] }),
2370
2375
  inputVisible && /* @__PURE__ */ jsx(Box$1, { my: 2, children: /* @__PURE__ */ jsx(
2371
2376
  CommentInput,
2372
2377
  {
@@ -4717,7 +4722,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
4717
4722
  }
4718
4723
  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
4724
  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-COKs8-Mn.mjs"));
4725
+ const Editor = lazy(() => import("./editor-C7bJ8adv.mjs"));
4721
4726
  function LazyEditor(props) {
4722
4727
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
4723
4728
  /* @__PURE__ */ jsx(Skeleton, {}),
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-CuCLDEJk.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-DO14VdHH.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -976,6 +976,7 @@ var __publicField = (obj, key, value) => {
976
976
  return {
977
977
  ...ctx,
978
978
  isAdmin: ["admin", "owner"].includes(loginRole),
979
+ isMember: ["member"].includes(loginRole),
979
980
  hasAnyPassport: (passports) => {
980
981
  if (!passports || passports.length === 0) {
981
982
  return true;
@@ -2233,6 +2234,7 @@ var __publicField = (obj, key, value) => {
2233
2234
  onReply,
2234
2235
  onContentUpdate,
2235
2236
  onLoadMoreReplies,
2237
+ actions,
2236
2238
  ...rest
2237
2239
  }) {
2238
2240
  const { session } = useSessionContext();
@@ -2259,40 +2261,43 @@ var __publicField = (obj, key, value) => {
2259
2261
  };
2260
2262
  const render = ({ post, interactive }) => {
2261
2263
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2262
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
2263
- GithubReaction,
2264
- {
2265
- data: (post == null ? void 0 : post.rating) || [],
2266
- onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2267
- onUnrate: () => onUnrate(post),
2268
- interactive,
2269
- append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
2270
- Box,
2271
- {
2272
- onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
2273
- sx: {
2274
- display: "flex",
2275
- alignItems: "center",
2276
- gap: 0.75,
2277
- fontSize: 13,
2278
- color: "text.secondary",
2279
- lineHeight: 1,
2280
- "&:hover": { cursor: "pointer" }
2281
- },
2282
- children: [
2283
- /* @__PURE__ */ jsxRuntime.jsx(
2284
- Box,
2285
- {
2286
- component: tablerMessageCircle,
2287
- sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2288
- }
2289
- ),
2290
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
2291
- ]
2292
- }
2293
- )
2294
- }
2295
- ) }),
2264
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: [
2265
+ /* @__PURE__ */ jsxRuntime.jsx(
2266
+ GithubReaction,
2267
+ {
2268
+ data: (post == null ? void 0 : post.rating) || [],
2269
+ onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2270
+ onUnrate: () => onUnrate(post),
2271
+ interactive,
2272
+ append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
2273
+ Box,
2274
+ {
2275
+ onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
2276
+ sx: {
2277
+ display: "flex",
2278
+ alignItems: "center",
2279
+ gap: 0.75,
2280
+ fontSize: 13,
2281
+ color: "text.secondary",
2282
+ lineHeight: 1,
2283
+ "&:hover": { cursor: "pointer" }
2284
+ },
2285
+ children: [
2286
+ /* @__PURE__ */ jsxRuntime.jsx(
2287
+ Box,
2288
+ {
2289
+ component: tablerMessageCircle,
2290
+ sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2291
+ }
2292
+ ),
2293
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
2294
+ ]
2295
+ }
2296
+ )
2297
+ }
2298
+ ),
2299
+ actions
2300
+ ] }),
2296
2301
  inputVisible && /* @__PURE__ */ jsxRuntime.jsx(Box, { my: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2297
2302
  CommentInput,
2298
2303
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.0.41",
3
+ "version": "2.0.43",
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.41",
35
- "@blocklet/labels": "2.0.41",
34
+ "@blocklet/editor": "2.0.43",
35
+ "@blocklet/labels": "2.0.43",
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": "19c38f05249441ba3f30c72bff498fe6e117191f"
103
+ "gitHead": "60d44b1cda7dc0d87fb7b665941bac5579049845"
104
104
  }