@blocklet/discuss-kit-ux 2.0.44 → 2.0.46
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.
- package/dist/components/posts/comment-list/context.d.ts +3 -1
- package/dist/components/posts/comment.d.ts +3 -2
- package/dist/{editor-C7bJ8adv.mjs → editor-DrfLRDGf.mjs} +1 -1
- package/dist/{index-DO14VdHH.mjs → index-D9B1V2OO.mjs} +37 -29
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +36 -28
- package/package.json +4 -4
|
@@ -20,6 +20,7 @@ interface CommentsProviderProps {
|
|
|
20
20
|
interactive?: boolean;
|
|
21
21
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
22
22
|
renderComments?: CommentsRender;
|
|
23
|
+
renderDonation?: (post: Post) => React.ReactNode;
|
|
23
24
|
}
|
|
24
25
|
interface State {
|
|
25
26
|
comments: Post[];
|
|
@@ -57,8 +58,9 @@ interface CommentsContextValue {
|
|
|
57
58
|
reply: CommentAPI['reply'];
|
|
58
59
|
findById: (id: string) => Post | undefined;
|
|
59
60
|
renderComments?: CommentsRender;
|
|
61
|
+
renderDonation?: (post: Post) => React.ReactNode;
|
|
60
62
|
}
|
|
61
63
|
export declare const CommentsContext: React.Context<CommentsContextValue>;
|
|
62
64
|
export declare const useCommentsContext: () => CommentsContextValue;
|
|
63
|
-
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, }: CommentsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, }: CommentsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
64
66
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PostProps } from './post';
|
|
2
|
-
import { CommentAPI } from '../../types';
|
|
2
|
+
import { CommentAPI, Post } from '../../types';
|
|
3
3
|
|
|
4
4
|
export interface CommentProps {
|
|
5
5
|
onDelete: CommentAPI['deleteComment'];
|
|
@@ -7,6 +7,7 @@ export interface CommentProps {
|
|
|
7
7
|
onUnrate: CommentAPI['unrate'];
|
|
8
8
|
onReply: CommentAPI['reply'];
|
|
9
9
|
onLoadMoreReplies: (rootId: string) => void;
|
|
10
|
+
renderDonation?: (post: Post) => React.ReactNode;
|
|
10
11
|
actions?: React.ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, actions, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, renderDonation, 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-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-D9B1V2OO.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -2308,6 +2308,7 @@ function Comment({
|
|
|
2308
2308
|
onReply,
|
|
2309
2309
|
onContentUpdate,
|
|
2310
2310
|
onLoadMoreReplies,
|
|
2311
|
+
renderDonation,
|
|
2311
2312
|
actions,
|
|
2312
2313
|
...rest
|
|
2313
2314
|
}) {
|
|
@@ -2343,31 +2344,34 @@ function Comment({
|
|
|
2343
2344
|
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2344
2345
|
onUnrate: () => onUnrate(post),
|
|
2345
2346
|
interactive,
|
|
2346
|
-
append:
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2347
|
+
append: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2348
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
|
|
2349
|
+
Box$1,
|
|
2350
|
+
{
|
|
2351
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2352
|
+
sx: {
|
|
2353
|
+
display: "flex",
|
|
2354
|
+
alignItems: "center",
|
|
2355
|
+
gap: 0.75,
|
|
2356
|
+
fontSize: 13,
|
|
2357
|
+
color: "text.secondary",
|
|
2358
|
+
lineHeight: 1,
|
|
2359
|
+
"&:hover": { cursor: "pointer" }
|
|
2360
|
+
},
|
|
2361
|
+
children: [
|
|
2362
|
+
/* @__PURE__ */ jsx(
|
|
2363
|
+
Box$1,
|
|
2364
|
+
{
|
|
2365
|
+
component: tablerMessageCircle,
|
|
2366
|
+
sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
|
|
2367
|
+
}
|
|
2368
|
+
),
|
|
2369
|
+
/* @__PURE__ */ jsx(Box$1, { component: "span", children: "Reply" })
|
|
2370
|
+
]
|
|
2371
|
+
}
|
|
2372
|
+
),
|
|
2373
|
+
renderDonation && renderDonation(post)
|
|
2374
|
+
] })
|
|
2371
2375
|
}
|
|
2372
2376
|
),
|
|
2373
2377
|
actions
|
|
@@ -2514,7 +2518,8 @@ function CommentsProvider({
|
|
|
2514
2518
|
showProfileCard,
|
|
2515
2519
|
interactive,
|
|
2516
2520
|
containerRef,
|
|
2517
|
-
renderComments
|
|
2521
|
+
renderComments,
|
|
2522
|
+
renderDonation
|
|
2518
2523
|
}) {
|
|
2519
2524
|
var _a2;
|
|
2520
2525
|
const [state, setState] = useSetState(getInitialState(order ? { order } : {}));
|
|
@@ -2715,7 +2720,8 @@ function CommentsProvider({
|
|
|
2715
2720
|
reply,
|
|
2716
2721
|
loadMoreReplies,
|
|
2717
2722
|
findById,
|
|
2718
|
-
renderComments
|
|
2723
|
+
renderComments,
|
|
2724
|
+
renderDonation
|
|
2719
2725
|
}),
|
|
2720
2726
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2721
2727
|
[target, state]
|
|
@@ -2821,7 +2827,8 @@ function CommentList(props) {
|
|
|
2821
2827
|
reply,
|
|
2822
2828
|
loadMoreReplies,
|
|
2823
2829
|
api,
|
|
2824
|
-
renderComments
|
|
2830
|
+
renderComments,
|
|
2831
|
+
renderDonation
|
|
2825
2832
|
} = useCommentsContext();
|
|
2826
2833
|
if (highlighted) {
|
|
2827
2834
|
return /* @__PURE__ */ jsx(SegmentalList, { ...props });
|
|
@@ -2840,6 +2847,7 @@ function CommentList(props) {
|
|
|
2840
2847
|
allowCopyLink,
|
|
2841
2848
|
showProfileCard,
|
|
2842
2849
|
interactive,
|
|
2850
|
+
renderDonation,
|
|
2843
2851
|
...restProps
|
|
2844
2852
|
},
|
|
2845
2853
|
comment.id
|
|
@@ -4722,7 +4730,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4722
4730
|
}
|
|
4723
4731
|
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" }) });
|
|
4724
4732
|
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" }) });
|
|
4725
|
-
const Editor = lazy(() => import("./editor-
|
|
4733
|
+
const Editor = lazy(() => import("./editor-DrfLRDGf.mjs"));
|
|
4726
4734
|
function LazyEditor(props) {
|
|
4727
4735
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4728
4736
|
/* @__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-
|
|
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-D9B1V2OO.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -2234,6 +2234,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2234
2234
|
onReply,
|
|
2235
2235
|
onContentUpdate,
|
|
2236
2236
|
onLoadMoreReplies,
|
|
2237
|
+
renderDonation,
|
|
2237
2238
|
actions,
|
|
2238
2239
|
...rest
|
|
2239
2240
|
}) {
|
|
@@ -2269,31 +2270,34 @@ var __publicField = (obj, key, value) => {
|
|
|
2269
2270
|
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2270
2271
|
onUnrate: () => onUnrate(post),
|
|
2271
2272
|
interactive,
|
|
2272
|
-
append:
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2273
|
+
append: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2274
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2275
|
+
Box,
|
|
2276
|
+
{
|
|
2277
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2278
|
+
sx: {
|
|
2279
|
+
display: "flex",
|
|
2280
|
+
alignItems: "center",
|
|
2281
|
+
gap: 0.75,
|
|
2282
|
+
fontSize: 13,
|
|
2283
|
+
color: "text.secondary",
|
|
2284
|
+
lineHeight: 1,
|
|
2285
|
+
"&:hover": { cursor: "pointer" }
|
|
2286
|
+
},
|
|
2287
|
+
children: [
|
|
2288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2289
|
+
Box,
|
|
2290
|
+
{
|
|
2291
|
+
component: tablerMessageCircle,
|
|
2292
|
+
sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
|
|
2293
|
+
}
|
|
2294
|
+
),
|
|
2295
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
|
|
2296
|
+
]
|
|
2297
|
+
}
|
|
2298
|
+
),
|
|
2299
|
+
renderDonation && renderDonation(post)
|
|
2300
|
+
] })
|
|
2297
2301
|
}
|
|
2298
2302
|
),
|
|
2299
2303
|
actions
|
|
@@ -2440,7 +2444,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2440
2444
|
showProfileCard,
|
|
2441
2445
|
interactive,
|
|
2442
2446
|
containerRef,
|
|
2443
|
-
renderComments
|
|
2447
|
+
renderComments,
|
|
2448
|
+
renderDonation
|
|
2444
2449
|
}) {
|
|
2445
2450
|
var _a2;
|
|
2446
2451
|
const [state, setState] = ahooks.useSetState(getInitialState(order ? { order } : {}));
|
|
@@ -2641,7 +2646,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2641
2646
|
reply,
|
|
2642
2647
|
loadMoreReplies,
|
|
2643
2648
|
findById,
|
|
2644
|
-
renderComments
|
|
2649
|
+
renderComments,
|
|
2650
|
+
renderDonation
|
|
2645
2651
|
}),
|
|
2646
2652
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2647
2653
|
[target, state]
|
|
@@ -2747,7 +2753,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2747
2753
|
reply,
|
|
2748
2754
|
loadMoreReplies,
|
|
2749
2755
|
api,
|
|
2750
|
-
renderComments
|
|
2756
|
+
renderComments,
|
|
2757
|
+
renderDonation
|
|
2751
2758
|
} = useCommentsContext();
|
|
2752
2759
|
if (highlighted) {
|
|
2753
2760
|
return /* @__PURE__ */ jsxRuntime.jsx(SegmentalList, { ...props });
|
|
@@ -2766,6 +2773,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2766
2773
|
allowCopyLink,
|
|
2767
2774
|
showProfileCard,
|
|
2768
2775
|
interactive,
|
|
2776
|
+
renderDonation,
|
|
2769
2777
|
...restProps
|
|
2770
2778
|
},
|
|
2771
2779
|
comment.id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.46",
|
|
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.
|
|
35
|
-
"@blocklet/labels": "2.0.
|
|
34
|
+
"@blocklet/editor": "2.0.46",
|
|
35
|
+
"@blocklet/labels": "2.0.46",
|
|
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": "
|
|
103
|
+
"gitHead": "aacdd3922f539000ddae02530aebd49641af17ef"
|
|
104
104
|
}
|