@blocklet/discuss-kit-ux 2.0.82 → 2.0.84
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 +2 -2
- package/dist/components/utils.d.ts +2 -1
- package/dist/{editor-C_9ooELE.mjs → editor-C5zNpwwt.mjs} +1 -1
- package/dist/{index-usvR3B2J.mjs → index-D7n269m9.mjs} +25 -16
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +22 -13
- package/package.json +4 -4
|
@@ -21,6 +21,7 @@ interface CommentsProviderProps {
|
|
|
21
21
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
22
22
|
renderComments?: CommentsRender;
|
|
23
23
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
24
|
+
renderActions?: (post: Post) => React.ReactNode;
|
|
24
25
|
}
|
|
25
26
|
interface State {
|
|
26
27
|
comments: Post[];
|
|
@@ -59,8 +60,9 @@ interface CommentsContextValue {
|
|
|
59
60
|
findById: (id: string) => Post | undefined;
|
|
60
61
|
renderComments?: CommentsRender;
|
|
61
62
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
63
|
+
renderActions?: (post: Post) => React.ReactNode;
|
|
62
64
|
}
|
|
63
65
|
export declare const CommentsContext: React.Context<CommentsContextValue>;
|
|
64
66
|
export declare const useCommentsContext: () => CommentsContextValue;
|
|
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;
|
|
67
|
+
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, renderActions, }: CommentsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
66
68
|
export {};
|
|
@@ -8,6 +8,6 @@ export interface CommentProps {
|
|
|
8
8
|
onReply: CommentAPI['reply'];
|
|
9
9
|
onLoadMoreReplies: (rootId: string) => void;
|
|
10
10
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
11
|
-
|
|
11
|
+
renderActions?: (post: Post) => React.ReactNode;
|
|
12
12
|
}
|
|
13
|
-
export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, renderDonation,
|
|
13
|
+
export default function Comment({ onDelete, onRate, onUnrate, onReply, onContentUpdate, onLoadMoreReplies, renderDonation, renderActions, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,4 +17,5 @@ export declare const getDraftSessionKeyPrefix: () => string;
|
|
|
17
17
|
export declare const getExcerptFromLexicalContent: (content: any, size?: number) => string;
|
|
18
18
|
export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<Theme>) => any[];
|
|
19
19
|
export declare const discussKitMountPoint: string | undefined;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const isInDiscussKitApp: boolean | "" | undefined;
|
|
21
|
+
export declare const openProfile: (did: string, newTab?: boolean) => void;
|
|
@@ -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-D7n269m9.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -16,8 +16,7 @@ import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/conf
|
|
|
16
16
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
17
17
|
import { $getRoot, $createParagraphNode, $createTextNode, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection } from "lexical";
|
|
18
18
|
import { $isRootTextContentEmpty } from "@lexical/text";
|
|
19
|
-
import {
|
|
20
|
-
import { joinURL } from "ufo";
|
|
19
|
+
import { withTrailingSlash, withQuery, joinURL } from "ufo";
|
|
21
20
|
import joinUrl from "url-join";
|
|
22
21
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
23
22
|
import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
@@ -36,6 +35,7 @@ import { grey, green, amber } from "@mui/material/colors";
|
|
|
36
35
|
import useMediaQuery$1 from "@mui/material/useMediaQuery";
|
|
37
36
|
import DID from "@arcblock/ux/lib/DID";
|
|
38
37
|
import Tooltip, { tooltipClasses } from "@mui/material/Tooltip";
|
|
38
|
+
import { Link, useNavigate, useMatch, useLocation, useParams, Outlet, useSearchParams, useBlocker } from "react-router-dom";
|
|
39
39
|
import { useBrowser } from "@arcblock/react-hooks";
|
|
40
40
|
import UxRelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
41
41
|
import Chip from "@mui/material/Chip";
|
|
@@ -343,10 +343,10 @@ const mergeSx = (initial, sx) => {
|
|
|
343
343
|
return mergedSx;
|
|
344
344
|
};
|
|
345
345
|
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
346
|
-
const
|
|
346
|
+
const isInDiscussKitApp = discussKitMountPoint && withTrailingSlash(window.blocklet.prefix) === withTrailingSlash(discussKitMountPoint);
|
|
347
|
+
const openProfile = (did, newTab) => {
|
|
347
348
|
if (did) {
|
|
348
|
-
|
|
349
|
-
window.open(joinURL(discussKitMountPoint || "/", pathname), "_blank");
|
|
349
|
+
window.open(withQuery(joinURL(discussKitMountPoint || "/", "profile"), { did }), newTab ? "_blank" : "_self");
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
352
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -361,9 +361,10 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
361
361
|
getPreference,
|
|
362
362
|
getResizedAvatar,
|
|
363
363
|
inferDiscussKitApiPrefix,
|
|
364
|
+
isInDiscussKitApp,
|
|
364
365
|
mergeSx,
|
|
365
366
|
minDelay,
|
|
366
|
-
|
|
367
|
+
openProfile,
|
|
367
368
|
protectLogin,
|
|
368
369
|
repairBase64Avatar,
|
|
369
370
|
sleep,
|
|
@@ -1323,10 +1324,14 @@ function AuthorInfo({
|
|
|
1323
1324
|
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1324
1325
|
setOpen(false);
|
|
1325
1326
|
if (chatInWallet) {
|
|
1326
|
-
|
|
1327
|
+
openProfile(user == null ? void 0 : user.did, true);
|
|
1327
1328
|
} else {
|
|
1328
1329
|
setTimeout(() => {
|
|
1329
|
-
|
|
1330
|
+
if (isInDiscussKitApp) {
|
|
1331
|
+
navigate(`/profile?did=${user == null ? void 0 : user.did}`);
|
|
1332
|
+
} else {
|
|
1333
|
+
openProfile(user == null ? void 0 : user.did);
|
|
1334
|
+
}
|
|
1330
1335
|
}, 100);
|
|
1331
1336
|
}
|
|
1332
1337
|
};
|
|
@@ -2318,7 +2323,7 @@ function Comment({
|
|
|
2318
2323
|
onContentUpdate,
|
|
2319
2324
|
onLoadMoreReplies,
|
|
2320
2325
|
renderDonation,
|
|
2321
|
-
|
|
2326
|
+
renderActions,
|
|
2322
2327
|
...rest
|
|
2323
2328
|
}) {
|
|
2324
2329
|
const { session } = useSessionContext();
|
|
@@ -2384,7 +2389,7 @@ function Comment({
|
|
|
2384
2389
|
] })
|
|
2385
2390
|
}
|
|
2386
2391
|
),
|
|
2387
|
-
|
|
2392
|
+
renderActions == null ? void 0 : renderActions(post)
|
|
2388
2393
|
] }),
|
|
2389
2394
|
inputVisible && /* @__PURE__ */ jsx(Box$1, { my: 2, children: /* @__PURE__ */ jsx(
|
|
2390
2395
|
CommentInput,
|
|
@@ -2417,7 +2422,7 @@ function Comment({
|
|
|
2417
2422
|
interactive: rest.interactive,
|
|
2418
2423
|
authorInfoAppend: rest.authorInfoAppend,
|
|
2419
2424
|
renderDonation,
|
|
2420
|
-
|
|
2425
|
+
renderActions
|
|
2421
2426
|
},
|
|
2422
2427
|
item.id
|
|
2423
2428
|
);
|
|
@@ -2532,7 +2537,8 @@ function CommentsProvider({
|
|
|
2532
2537
|
interactive,
|
|
2533
2538
|
containerRef,
|
|
2534
2539
|
renderComments,
|
|
2535
|
-
renderDonation
|
|
2540
|
+
renderDonation,
|
|
2541
|
+
renderActions
|
|
2536
2542
|
}) {
|
|
2537
2543
|
var _a2;
|
|
2538
2544
|
const [state, setState] = useSetState(getInitialState(order ? { order } : {}));
|
|
@@ -2734,7 +2740,8 @@ function CommentsProvider({
|
|
|
2734
2740
|
loadMoreReplies,
|
|
2735
2741
|
findById,
|
|
2736
2742
|
renderComments,
|
|
2737
|
-
renderDonation
|
|
2743
|
+
renderDonation,
|
|
2744
|
+
renderActions
|
|
2738
2745
|
}),
|
|
2739
2746
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2740
2747
|
[target, state]
|
|
@@ -2841,7 +2848,8 @@ function CommentList(props) {
|
|
|
2841
2848
|
loadMoreReplies,
|
|
2842
2849
|
api,
|
|
2843
2850
|
renderComments,
|
|
2844
|
-
renderDonation
|
|
2851
|
+
renderDonation,
|
|
2852
|
+
renderActions
|
|
2845
2853
|
} = useCommentsContext();
|
|
2846
2854
|
if (highlighted) {
|
|
2847
2855
|
return /* @__PURE__ */ jsx(SegmentalList, { ...props });
|
|
@@ -2861,6 +2869,7 @@ function CommentList(props) {
|
|
|
2861
2869
|
showProfileCard,
|
|
2862
2870
|
interactive,
|
|
2863
2871
|
renderDonation,
|
|
2872
|
+
renderActions,
|
|
2864
2873
|
...restProps
|
|
2865
2874
|
},
|
|
2866
2875
|
comment.id
|
|
@@ -4751,7 +4760,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4751
4760
|
}
|
|
4752
4761
|
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" }) });
|
|
4753
4762
|
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" }) });
|
|
4754
|
-
const Editor = lazy(() => import("./editor-
|
|
4763
|
+
const Editor = lazy(() => import("./editor-C5zNpwwt.mjs"));
|
|
4755
4764
|
function LazyEditor(props) {
|
|
4756
4765
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4757
4766
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5719,7 +5728,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5719
5728
|
variant: "circle",
|
|
5720
5729
|
onClick: () => {
|
|
5721
5730
|
var _a3;
|
|
5722
|
-
return
|
|
5731
|
+
return openProfile((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did, true);
|
|
5723
5732
|
}
|
|
5724
5733
|
}
|
|
5725
5734
|
)
|
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-D7n269m9.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -269,10 +269,10 @@ var __publicField = (obj, key, value) => {
|
|
|
269
269
|
return mergedSx;
|
|
270
270
|
};
|
|
271
271
|
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
272
|
-
const
|
|
272
|
+
const isInDiscussKitApp = discussKitMountPoint && ufo.withTrailingSlash(window.blocklet.prefix) === ufo.withTrailingSlash(discussKitMountPoint);
|
|
273
|
+
const openProfile = (did, newTab) => {
|
|
273
274
|
if (did) {
|
|
274
|
-
|
|
275
|
-
window.open(ufo.joinURL(discussKitMountPoint || "/", pathname), "_blank");
|
|
275
|
+
window.open(ufo.withQuery(ufo.joinURL(discussKitMountPoint || "/", "profile"), { did }), newTab ? "_blank" : "_self");
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -287,9 +287,10 @@ var __publicField = (obj, key, value) => {
|
|
|
287
287
|
getPreference,
|
|
288
288
|
getResizedAvatar,
|
|
289
289
|
inferDiscussKitApiPrefix,
|
|
290
|
+
isInDiscussKitApp,
|
|
290
291
|
mergeSx,
|
|
291
292
|
minDelay,
|
|
292
|
-
|
|
293
|
+
openProfile,
|
|
293
294
|
protectLogin,
|
|
294
295
|
repairBase64Avatar,
|
|
295
296
|
sleep,
|
|
@@ -1249,10 +1250,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1249
1250
|
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1250
1251
|
setOpen(false);
|
|
1251
1252
|
if (chatInWallet) {
|
|
1252
|
-
|
|
1253
|
+
openProfile(user == null ? void 0 : user.did, true);
|
|
1253
1254
|
} else {
|
|
1254
1255
|
setTimeout(() => {
|
|
1255
|
-
|
|
1256
|
+
if (isInDiscussKitApp) {
|
|
1257
|
+
navigate(`/profile?did=${user == null ? void 0 : user.did}`);
|
|
1258
|
+
} else {
|
|
1259
|
+
openProfile(user == null ? void 0 : user.did);
|
|
1260
|
+
}
|
|
1256
1261
|
}, 100);
|
|
1257
1262
|
}
|
|
1258
1263
|
};
|
|
@@ -2244,7 +2249,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2244
2249
|
onContentUpdate,
|
|
2245
2250
|
onLoadMoreReplies,
|
|
2246
2251
|
renderDonation,
|
|
2247
|
-
|
|
2252
|
+
renderActions,
|
|
2248
2253
|
...rest
|
|
2249
2254
|
}) {
|
|
2250
2255
|
const { session } = useSessionContext();
|
|
@@ -2310,7 +2315,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2310
2315
|
] })
|
|
2311
2316
|
}
|
|
2312
2317
|
),
|
|
2313
|
-
|
|
2318
|
+
renderActions == null ? void 0 : renderActions(post)
|
|
2314
2319
|
] }),
|
|
2315
2320
|
inputVisible && /* @__PURE__ */ jsxRuntime.jsx(Box, { my: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2316
2321
|
CommentInput,
|
|
@@ -2343,7 +2348,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2343
2348
|
interactive: rest.interactive,
|
|
2344
2349
|
authorInfoAppend: rest.authorInfoAppend,
|
|
2345
2350
|
renderDonation,
|
|
2346
|
-
|
|
2351
|
+
renderActions
|
|
2347
2352
|
},
|
|
2348
2353
|
item.id
|
|
2349
2354
|
);
|
|
@@ -2458,7 +2463,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2458
2463
|
interactive,
|
|
2459
2464
|
containerRef,
|
|
2460
2465
|
renderComments,
|
|
2461
|
-
renderDonation
|
|
2466
|
+
renderDonation,
|
|
2467
|
+
renderActions
|
|
2462
2468
|
}) {
|
|
2463
2469
|
var _a2;
|
|
2464
2470
|
const [state, setState] = ahooks.useSetState(getInitialState(order ? { order } : {}));
|
|
@@ -2660,7 +2666,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2660
2666
|
loadMoreReplies,
|
|
2661
2667
|
findById,
|
|
2662
2668
|
renderComments,
|
|
2663
|
-
renderDonation
|
|
2669
|
+
renderDonation,
|
|
2670
|
+
renderActions
|
|
2664
2671
|
}),
|
|
2665
2672
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2666
2673
|
[target, state]
|
|
@@ -2767,7 +2774,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2767
2774
|
loadMoreReplies,
|
|
2768
2775
|
api,
|
|
2769
2776
|
renderComments,
|
|
2770
|
-
renderDonation
|
|
2777
|
+
renderDonation,
|
|
2778
|
+
renderActions
|
|
2771
2779
|
} = useCommentsContext();
|
|
2772
2780
|
if (highlighted) {
|
|
2773
2781
|
return /* @__PURE__ */ jsxRuntime.jsx(SegmentalList, { ...props });
|
|
@@ -2787,6 +2795,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2787
2795
|
showProfileCard,
|
|
2788
2796
|
interactive,
|
|
2789
2797
|
renderDonation,
|
|
2798
|
+
renderActions,
|
|
2790
2799
|
...restProps
|
|
2791
2800
|
},
|
|
2792
2801
|
comment.id
|
|
@@ -5645,7 +5654,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5645
5654
|
variant: "circle",
|
|
5646
5655
|
onClick: () => {
|
|
5647
5656
|
var _a3;
|
|
5648
|
-
return
|
|
5657
|
+
return openProfile((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.did, true);
|
|
5649
5658
|
}
|
|
5650
5659
|
}
|
|
5651
5660
|
)
|
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.84",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@arcblock/bridge": "^2.10.6",
|
|
32
32
|
"@arcblock/react-hooks": "^2.10.6",
|
|
33
33
|
"@arcblock/ws": "^1.18.126",
|
|
34
|
-
"@blocklet/editor": "2.0.
|
|
35
|
-
"@blocklet/labels": "2.0.
|
|
34
|
+
"@blocklet/editor": "2.0.84",
|
|
35
|
+
"@blocklet/labels": "2.0.84",
|
|
36
36
|
"@blocklet/uploader": "^0.1.19",
|
|
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": "616816e0b718c1281dc04a8f25b898c4c023cb80"
|
|
104
104
|
}
|