@blocklet/discuss-kit-ux-lite 2.6.3 → 2.6.5
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/avatars/author-info.d.ts +2 -1
- package/dist/components/avatars/author-info.mjs +8 -0
- package/dist/components/posts/comment-list/comment-list.mjs +7 -3
- package/dist/components/posts/comment-list/context.d.ts +3 -1
- package/dist/components/posts/comment-list/context.mjs +4 -2
- package/dist/components/posts/comment.d.ts +2 -1
- package/dist/components/posts/comment.mjs +5 -2
- package/dist/components/posts/post.d.ts +2 -1
- package/dist/components/posts/post.mjs +3 -1
- package/package.json +4 -4
|
@@ -18,6 +18,7 @@ interface Props {
|
|
|
18
18
|
fontSize?: number;
|
|
19
19
|
copyable?: boolean;
|
|
20
20
|
sx?: SxProps;
|
|
21
|
+
profileUrl?: (user: User) => string | void;
|
|
21
22
|
}
|
|
22
|
-
export default function AuthorInfo({ user, createdAt, append, size, responsive, showProfileCard, showBadge, showDID, newTitle, children, linkToProfile, onAvatarClick, avatarSize, fontSize, copyable, sx, ...rest }: Props): import("react").JSX.Element;
|
|
23
|
+
export default function AuthorInfo({ user, createdAt, append, size, responsive, showProfileCard, showBadge, showDID, newTitle, children, linkToProfile, onAvatarClick, avatarSize, fontSize, copyable, sx, profileUrl, ...rest }: Props): import("react").JSX.Element;
|
|
23
24
|
export {};
|
|
@@ -30,6 +30,7 @@ export default function AuthorInfo({
|
|
|
30
30
|
fontSize,
|
|
31
31
|
copyable,
|
|
32
32
|
sx,
|
|
33
|
+
profileUrl,
|
|
33
34
|
...rest
|
|
34
35
|
}) {
|
|
35
36
|
const theme = useTheme();
|
|
@@ -65,6 +66,13 @@ export default function AuthorInfo({
|
|
|
65
66
|
if (!canClick) return;
|
|
66
67
|
e?.stopPropagation?.();
|
|
67
68
|
e?.preventDefault?.();
|
|
69
|
+
if (profileUrl) {
|
|
70
|
+
const result = profileUrl(user);
|
|
71
|
+
if (typeof result === "string") {
|
|
72
|
+
window.location.href = result;
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
68
76
|
setTimeout(() => {
|
|
69
77
|
if (isInDiscussKitApp) {
|
|
70
78
|
navigate(`/profile?did=${user?.did}`);
|
|
@@ -27,7 +27,8 @@ function SegmentalList({ ...rest }) {
|
|
|
27
27
|
reply,
|
|
28
28
|
togglePin,
|
|
29
29
|
loadMoreReplies,
|
|
30
|
-
api
|
|
30
|
+
api,
|
|
31
|
+
profileUrl
|
|
31
32
|
} = useCommentsContext();
|
|
32
33
|
if (!highlighted) {
|
|
33
34
|
return null;
|
|
@@ -76,7 +77,8 @@ function SegmentalList({ ...rest }) {
|
|
|
76
77
|
autoCollapse,
|
|
77
78
|
allowCopyLink,
|
|
78
79
|
showProfileCard,
|
|
79
|
-
interactive
|
|
80
|
+
interactive,
|
|
81
|
+
profileUrl
|
|
80
82
|
}
|
|
81
83
|
)
|
|
82
84
|
] }, comment.id);
|
|
@@ -115,7 +117,8 @@ export default function CommentList(props) {
|
|
|
115
117
|
renderDonation,
|
|
116
118
|
renderActions,
|
|
117
119
|
renderEditorPlugins,
|
|
118
|
-
enableAutoTranslate
|
|
120
|
+
enableAutoTranslate,
|
|
121
|
+
profileUrl
|
|
119
122
|
} = useCommentsContext();
|
|
120
123
|
if (highlighted) {
|
|
121
124
|
return /* @__PURE__ */ jsx(SegmentalList, { ...props });
|
|
@@ -139,6 +142,7 @@ export default function CommentList(props) {
|
|
|
139
142
|
renderActions,
|
|
140
143
|
renderEditorPlugins,
|
|
141
144
|
enableAutoTranslate,
|
|
145
|
+
profileUrl,
|
|
142
146
|
...restProps
|
|
143
147
|
},
|
|
144
148
|
comment.id
|
|
@@ -24,6 +24,7 @@ interface CommentsProviderProps {
|
|
|
24
24
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
25
25
|
enableAutoTranslate?: boolean;
|
|
26
26
|
renderInnerFooter?: (post: Post) => React.ReactElement<any>;
|
|
27
|
+
profileUrl?: (user: Post['author']) => string | void;
|
|
27
28
|
}
|
|
28
29
|
interface State {
|
|
29
30
|
comments: Post[];
|
|
@@ -69,8 +70,9 @@ interface CommentsContextValue {
|
|
|
69
70
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
70
71
|
enableAutoTranslate?: boolean;
|
|
71
72
|
renderInnerFooter?: (post: Post) => React.ReactElement<any>;
|
|
73
|
+
profileUrl?: (user: Post['author']) => string | void;
|
|
72
74
|
}
|
|
73
75
|
export declare const CommentsContext: import("react").Context<CommentsContextValue>;
|
|
74
76
|
export declare const useCommentsContext: () => CommentsContextValue;
|
|
75
|
-
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, renderInnerFooter, }: CommentsProviderProps): JSX.Element;
|
|
77
|
+
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, renderInnerFooter, profileUrl, }: CommentsProviderProps): JSX.Element;
|
|
76
78
|
export {};
|
|
@@ -87,7 +87,8 @@ export function CommentsProvider({
|
|
|
87
87
|
renderActions,
|
|
88
88
|
renderEditorPlugins,
|
|
89
89
|
enableAutoTranslate,
|
|
90
|
-
renderInnerFooter
|
|
90
|
+
renderInnerFooter,
|
|
91
|
+
profileUrl
|
|
91
92
|
}) {
|
|
92
93
|
const [state, setState] = useSetState(getInitialState(order ? { order } : {}));
|
|
93
94
|
const comments = useMemo(
|
|
@@ -309,7 +310,8 @@ export function CommentsProvider({
|
|
|
309
310
|
renderActions,
|
|
310
311
|
renderEditorPlugins,
|
|
311
312
|
enableAutoTranslate,
|
|
312
|
-
renderInnerFooter
|
|
313
|
+
renderInnerFooter,
|
|
314
|
+
profileUrl
|
|
313
315
|
}),
|
|
314
316
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
315
317
|
[target, state]
|
|
@@ -12,5 +12,6 @@ export interface CommentProps {
|
|
|
12
12
|
renderActions?: (post: Post) => React.ReactNode;
|
|
13
13
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
14
14
|
enableAutoTranslate?: boolean;
|
|
15
|
+
profileUrl?: (user: Post['author']) => string | void;
|
|
15
16
|
}
|
|
16
|
-
export default function Comment({ onDelete, onRate, onUnrate, onReply, onTogglePin, onContentUpdate, onLoadMoreReplies, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, ...rest }: PostProps & CommentProps): import("react").JSX.Element;
|
|
17
|
+
export default function Comment({ onDelete, onRate, onUnrate, onReply, onTogglePin, onContentUpdate, onLoadMoreReplies, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, profileUrl, ...rest }: PostProps & CommentProps): import("react").JSX.Element;
|
|
@@ -30,6 +30,7 @@ export default function Comment({
|
|
|
30
30
|
renderActions,
|
|
31
31
|
renderEditorPlugins,
|
|
32
32
|
enableAutoTranslate,
|
|
33
|
+
profileUrl,
|
|
33
34
|
...rest
|
|
34
35
|
}) {
|
|
35
36
|
const { session } = useSessionContext();
|
|
@@ -141,7 +142,8 @@ export default function Comment({
|
|
|
141
142
|
renderDonation,
|
|
142
143
|
renderActions,
|
|
143
144
|
renderEditorPlugins,
|
|
144
|
-
enableAutoTranslate
|
|
145
|
+
enableAutoTranslate,
|
|
146
|
+
profileUrl
|
|
145
147
|
},
|
|
146
148
|
item.id
|
|
147
149
|
);
|
|
@@ -178,7 +180,8 @@ export default function Comment({
|
|
|
178
180
|
render,
|
|
179
181
|
renderExtraContent,
|
|
180
182
|
editorPlugins: renderEditorPlugins?.(rest.post),
|
|
181
|
-
enableAutoTranslate
|
|
183
|
+
enableAutoTranslate,
|
|
184
|
+
profileUrl
|
|
182
185
|
}
|
|
183
186
|
) });
|
|
184
187
|
}
|
|
@@ -15,6 +15,7 @@ export interface PostProps {
|
|
|
15
15
|
resolveAuthorInfoAppend?: (post: Post) => React.ReactNode;
|
|
16
16
|
editorPlugins?: React.ReactNode;
|
|
17
17
|
enableAutoTranslate?: boolean;
|
|
18
|
+
profileUrl?: (user: Post['author']) => string | void;
|
|
18
19
|
}
|
|
19
20
|
interface PostContext {
|
|
20
21
|
isAdmin: boolean;
|
|
@@ -22,5 +23,5 @@ interface PostContext {
|
|
|
22
23
|
interactive: boolean;
|
|
23
24
|
post: Post;
|
|
24
25
|
}
|
|
25
|
-
export default function PostComponent({ post, render, renderExtraContent, customMenu, interactive, onContentUpdate, allowCopyLink, autoCollapse, showProfileCard, resolveAuthorInfoAppend, editorPlugins, enableAutoTranslate, ...rest }: PostProps): JSX.Element;
|
|
26
|
+
export default function PostComponent({ post, render, renderExtraContent, customMenu, interactive, onContentUpdate, allowCopyLink, autoCollapse, showProfileCard, resolveAuthorInfoAppend, editorPlugins, enableAutoTranslate, profileUrl, ...rest }: PostProps): JSX.Element;
|
|
26
27
|
export {};
|
|
@@ -52,6 +52,7 @@ export default function PostComponent({
|
|
|
52
52
|
resolveAuthorInfoAppend = () => void 0,
|
|
53
53
|
editorPlugins,
|
|
54
54
|
enableAutoTranslate,
|
|
55
|
+
profileUrl,
|
|
55
56
|
...rest
|
|
56
57
|
}) {
|
|
57
58
|
const { session, isAdmin } = useSessionContext();
|
|
@@ -131,7 +132,8 @@ export default function PostComponent({
|
|
|
131
132
|
createdAt: renderTime(),
|
|
132
133
|
showProfileCard,
|
|
133
134
|
append: resolveAuthorInfoAppend(post),
|
|
134
|
-
showDID: false
|
|
135
|
+
showDID: false,
|
|
136
|
+
profileUrl
|
|
135
137
|
}
|
|
136
138
|
),
|
|
137
139
|
/* @__PURE__ */ jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux-lite",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@arcblock/bridge": "^3.
|
|
19
|
-
"@arcblock/react-hooks": "^3.
|
|
18
|
+
"@arcblock/bridge": "^3.4.1",
|
|
19
|
+
"@arcblock/react-hooks": "^3.4.1",
|
|
20
20
|
"@arcblock/ws": "^1.28.1",
|
|
21
21
|
"@blocklet/js-sdk": "^1.17.8-beta-20260104-120132-cb5b1914",
|
|
22
22
|
"@blocklet/uploader": "^0.3.19",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ufo": "^1.5.4",
|
|
45
45
|
"unstated-next": "^1.1.0",
|
|
46
46
|
"zustand": "^4.5.5",
|
|
47
|
-
"@blocklet/editor-lite": "2.6.
|
|
47
|
+
"@blocklet/editor-lite": "2.6.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@arcblock/did-connect-react": "^3.1.5",
|