@blocklet/discuss-kit 2.3.105 → 2.4.0
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/lib/cjs/api.js +1 -51
- package/lib/cjs/comments-dialog.js +1 -24
- package/lib/cjs/comments-installer.js +1 -18
- package/lib/cjs/comments-with-session.js +1 -15
- package/lib/cjs/comments.js +4 -387
- package/lib/cjs/components/error-fallback.js +1 -17
- package/lib/cjs/components/menu.js +3 -58
- package/lib/cjs/constants.js +1 -4
- package/lib/cjs/hooks/comment-listener.js +1 -17
- package/lib/cjs/hooks/topic-info-sync.js +1 -22
- package/lib/cjs/index.js +1 -25
- package/lib/cjs/lib/utils.js +1 -37
- package/lib/cjs/locales/en.js +1 -52
- package/lib/cjs/locales/index.js +1 -8
- package/lib/cjs/locales/zh.js +1 -54
- package/lib/cjs/session.js +1 -14
- package/lib/es/api.js +30 -37
- package/lib/es/comments-dialog.js +15 -15
- package/lib/es/comments-installer.js +36 -15
- package/lib/es/comments-with-session.js +10 -13
- package/lib/es/comments.js +320 -353
- package/lib/es/components/error-fallback.js +12 -12
- package/lib/es/components/menu.js +40 -41
- package/lib/es/constants.js +2 -2
- package/lib/es/hooks/comment-listener.js +10 -12
- package/lib/es/hooks/topic-info-sync.js +14 -16
- package/lib/es/index.js +11 -11
- package/lib/es/lib/utils.js +16 -31
- package/lib/es/locales/en.js +3 -3
- package/lib/es/locales/index.js +6 -6
- package/lib/es/locales/zh.js +3 -3
- package/lib/es/session.js +10 -11
- package/package.json +18 -17
package/lib/es/comments.js
CHANGED
|
@@ -1,392 +1,359 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
4
|
-
import
|
|
5
|
-
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
6
|
-
import { Alert, AlertTitle, Box, CircularProgress } from "@mui/material";
|
|
7
|
-
import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
|
|
8
|
-
import { ErrorBoundary } from "react-error-boundary";
|
|
9
|
-
import {
|
|
10
|
-
import { useRequest } from "ahooks";
|
|
11
|
-
import
|
|
12
|
-
import { translations } from "./locales";
|
|
13
|
-
import { discussKitPrefix } from "./lib/utils";
|
|
14
|
-
import
|
|
15
|
-
import { useTopicInfoSync } from "./hooks/topic-info-sync";
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
const commentAPI = {
|
|
40
|
-
fetchComments: async (params) => {
|
|
41
|
-
const copy = {
|
|
42
|
-
...params,
|
|
43
|
-
embed: params.rootId ? "rating" : "replies,rating",
|
|
44
|
-
size: params.limit
|
|
45
|
-
};
|
|
46
|
-
const {
|
|
47
|
-
data: { data, nextCursor, total }
|
|
48
|
-
} = await api.get("/comments", { params: copy });
|
|
49
|
-
return { data: data == null ? void 0 : data.map(formatComment), nextCursor, total };
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as J, useMemo as Q, useEffect as X, useContext as Y, useState as Z } from "react";
|
|
3
|
+
import { styled as ee } from "@arcblock/ux/lib/Theme";
|
|
4
|
+
import t from "prop-types";
|
|
5
|
+
import { SessionContext as te } from "@arcblock/did-connect/lib/Session";
|
|
6
|
+
import { Alert as ne, AlertTitle as oe, Box as p, CircularProgress as re } from "@mui/material";
|
|
7
|
+
import { useLocaleContext as F, LocaleProvider as ie } from "@arcblock/ux/lib/Locale/context";
|
|
8
|
+
import { ErrorBoundary as se } from "react-error-boundary";
|
|
9
|
+
import { getWsClient as ae, UploaderProvider as le, InternalThemeProvider as de, ConfirmProvider as ce, DefaultEditorConfigProvider as ue, CommentsProvider as me, useDefaultApiErrorHandler as pe, useCommentsContext as fe, useSubscription as Ce, IconButtonGroup as he, GithubReactionContainer as be, SegmentedControl as ge, CommentList as ye, CommentInput as we } from "@blocklet/discuss-kit-ux";
|
|
10
|
+
import { useRequest as xe } from "ahooks";
|
|
11
|
+
import Ae from "./components/error-fallback.js";
|
|
12
|
+
import { translations as ve } from "./locales/index.js";
|
|
13
|
+
import { discussKitPrefix as Ie } from "./lib/utils.js";
|
|
14
|
+
import s, { fetchRatings as Pe } from "./api.js";
|
|
15
|
+
import { useTopicInfoSync as Te } from "./hooks/topic-info-sync.js";
|
|
16
|
+
const $e = () => {
|
|
17
|
+
const e = (o) => o.endsWith("/") ? o : `${o}/`;
|
|
18
|
+
return window.blocklet?.componentMountPoints?.find(
|
|
19
|
+
(o) => e(o.mountPoint) === e(window.blocklet?.prefix)
|
|
20
|
+
)?.title;
|
|
21
|
+
}, d = (e) => ({
|
|
22
|
+
...e,
|
|
23
|
+
rootId: e.rootCommentId,
|
|
24
|
+
createdAt: e.createdAt ? new Date(e.createdAt) : null,
|
|
25
|
+
updatedAt: e.updatedAt ? new Date(e.updatedAt) : null,
|
|
26
|
+
deletedAt: e.deletedAt ? new Date(e.deletedAt) : null,
|
|
27
|
+
pinnedAt: e.pinnedAt ? new Date(e.pinnedAt) : null,
|
|
28
|
+
replies: e.replies?.map(d)
|
|
29
|
+
}), Se = {
|
|
30
|
+
fetchComments: async (e) => {
|
|
31
|
+
const n = {
|
|
32
|
+
...e,
|
|
33
|
+
embed: e.rootId ? "rating" : "replies,rating",
|
|
34
|
+
size: e.limit
|
|
35
|
+
}, {
|
|
36
|
+
data: { data: o, nextCursor: l, total: f }
|
|
37
|
+
} = await s.get("/comments", { params: n });
|
|
38
|
+
return { data: o?.map(d), nextCursor: l, total: f };
|
|
50
39
|
},
|
|
51
|
-
fetchPinnedComments: async (
|
|
52
|
-
const { data } = await
|
|
53
|
-
return (
|
|
40
|
+
fetchPinnedComments: async (e) => {
|
|
41
|
+
const { data: n } = await s.get("/comments/pinned", { params: { objectId: e } });
|
|
42
|
+
return (n?.data || []).map(d);
|
|
54
43
|
},
|
|
55
|
-
fetchCommentPosition: async ({ id, ...
|
|
56
|
-
const { data } = await
|
|
57
|
-
return
|
|
44
|
+
fetchCommentPosition: async ({ id: e, ...n }) => {
|
|
45
|
+
const { data: o } = await s.get(`/comments/${e}/position`, { params: n });
|
|
46
|
+
return o;
|
|
58
47
|
},
|
|
59
|
-
deleteComment: async ({ id }) => {
|
|
60
|
-
const { data } = await
|
|
61
|
-
return
|
|
48
|
+
deleteComment: async ({ id: e }) => {
|
|
49
|
+
const { data: n } = await s.delete(`/comments/${e}`);
|
|
50
|
+
return n;
|
|
62
51
|
},
|
|
63
|
-
updateComment: async ({ id, updatedAt },
|
|
64
|
-
const { data } = await
|
|
65
|
-
return
|
|
52
|
+
updateComment: async ({ id: e, updatedAt: n }, o) => {
|
|
53
|
+
const { data: l } = await s.put(`/comments/${e}`, { content: o, updatedAt: n });
|
|
54
|
+
return d(l);
|
|
66
55
|
},
|
|
67
|
-
reply: async ({ id },
|
|
68
|
-
const { data } = await
|
|
69
|
-
content,
|
|
70
|
-
parentId:
|
|
56
|
+
reply: async ({ id: e }, n) => {
|
|
57
|
+
const { data: o } = await s.post("/comments/replies", {
|
|
58
|
+
content: n,
|
|
59
|
+
parentId: e,
|
|
71
60
|
link: window.location.href
|
|
72
61
|
});
|
|
73
|
-
return
|
|
62
|
+
return d(o);
|
|
74
63
|
},
|
|
75
|
-
rate: async (
|
|
76
|
-
await
|
|
64
|
+
rate: async (e, n, o) => {
|
|
65
|
+
await s.post(`/topics/${e.topicId}/comments/${e.id}/ratings`, { ratingType: o, value: n });
|
|
77
66
|
},
|
|
78
|
-
unrate: async (
|
|
79
|
-
await
|
|
67
|
+
unrate: async (e) => {
|
|
68
|
+
await s.delete(`/topics/${e.topicId}/comments/${e.id}/ratings`);
|
|
80
69
|
},
|
|
81
|
-
fetchRatings: async (
|
|
82
|
-
const { data } = await
|
|
83
|
-
return
|
|
70
|
+
fetchRatings: async (e) => {
|
|
71
|
+
const { data: n } = await s.get(`/ratings/${e}`);
|
|
72
|
+
return n;
|
|
84
73
|
},
|
|
85
|
-
togglePin: async ({ post, value }) => {
|
|
86
|
-
|
|
87
|
-
await api.put(`/posts/${post.id}/pinned`);
|
|
88
|
-
} else {
|
|
89
|
-
await api.delete(`/posts/${post.id}/pinned`);
|
|
90
|
-
}
|
|
74
|
+
togglePin: async ({ post: e, value: n }) => {
|
|
75
|
+
n ? await s.put(`/posts/${e.id}/pinned`) : await s.delete(`/posts/${e.id}/pinned`);
|
|
91
76
|
}
|
|
92
|
-
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
() => api.get("/status", { muteError: true }).then(() => setAvailable(true)).catch(() => setAvailable(false)),
|
|
77
|
+
}, Re = () => {
|
|
78
|
+
const [e, n] = Z(!0);
|
|
79
|
+
return xe(
|
|
80
|
+
() => s.get("/status", { muteError: !0 }).then(() => n(!0)).catch(() => n(!1)),
|
|
97
81
|
{ cacheKey: "discuss-kit-status", staleTime: -1 }
|
|
98
|
-
);
|
|
99
|
-
return { available };
|
|
82
|
+
), { available: e };
|
|
100
83
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
84
|
+
function K({
|
|
85
|
+
ref: e = void 0,
|
|
86
|
+
displayReaction: n = !0,
|
|
87
|
+
object: o,
|
|
88
|
+
onChange: l = () => {
|
|
89
|
+
},
|
|
90
|
+
onSendComment: f = () => {
|
|
91
|
+
},
|
|
92
|
+
commentInputPosition: C = "top",
|
|
93
|
+
autoFocus: w = !1,
|
|
94
|
+
disabledSend: x = void 0,
|
|
95
|
+
initialContent: A = "",
|
|
96
|
+
sendText: v = "",
|
|
97
|
+
sendIcon: I = null,
|
|
98
|
+
showTopbar: P = !0,
|
|
99
|
+
sendComment: h = null,
|
|
100
|
+
reactionAppend: T = null,
|
|
101
|
+
skeleton: $ = null,
|
|
102
|
+
placeholder: S = "",
|
|
103
|
+
onInput: R = () => {
|
|
104
|
+
},
|
|
105
|
+
draftKey: b = "",
|
|
106
|
+
inputSx: g = {},
|
|
107
|
+
editorRef: y = null,
|
|
108
|
+
disableCmdEnter: O = !1
|
|
109
|
+
}) {
|
|
110
|
+
pe({
|
|
111
|
+
request: s
|
|
112
|
+
});
|
|
113
|
+
const { available: B } = Re(), { session: k } = Y(te) || {}, { state: q, sort: L, add: M, updateCommentState: N, interactive: D, findById: U, renderInnerFooter: W } = fe(), { total: E, order: z, initialized: G } = q, { t: c } = F();
|
|
114
|
+
Te(o);
|
|
115
|
+
const _ = {
|
|
116
|
+
ADD_COMMENT: (i) => {
|
|
117
|
+
M(d(i)), l?.();
|
|
118
|
+
},
|
|
119
|
+
UPDATE_COMMENT: (i) => {
|
|
120
|
+
const a = U(i.id);
|
|
121
|
+
a && a.content !== i.content && N(i.id, (u) => (u.content = i.content, u.updatedAt = i.updatedAt, u.synced = Date.now(), u));
|
|
122
|
+
},
|
|
123
|
+
RATING_COMMENT: async ({ commentId: i }) => {
|
|
124
|
+
const a = await Pe(i);
|
|
125
|
+
N(i, (u) => ({
|
|
126
|
+
...u,
|
|
127
|
+
rating: a
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
if (Ce(
|
|
132
|
+
o.id,
|
|
133
|
+
({ event: i, data: a }) => {
|
|
134
|
+
_[i]?.(a);
|
|
135
|
+
},
|
|
136
|
+
[o.id, q]
|
|
137
|
+
), !B)
|
|
138
|
+
return /* @__PURE__ */ m(ne, { severity: "info", children: [
|
|
139
|
+
/* @__PURE__ */ r(oe, { children: c("apiUnavailable.title") }),
|
|
140
|
+
c("apiUnavailable.desc")
|
|
141
|
+
] });
|
|
142
|
+
if (!G)
|
|
143
|
+
return $ || /* @__PURE__ */ r(
|
|
144
|
+
p,
|
|
145
|
+
{
|
|
146
|
+
sx: {
|
|
147
|
+
width: "100%",
|
|
148
|
+
display: "flex",
|
|
149
|
+
justifyContent: "center"
|
|
150
|
+
},
|
|
151
|
+
children: /* @__PURE__ */ r(re, {})
|
|
155
152
|
}
|
|
156
|
-
};
|
|
157
|
-
useSubscription(
|
|
158
|
-
object.id,
|
|
159
|
-
({ event, data }) => {
|
|
160
|
-
var _a;
|
|
161
|
-
(_a = handlers[event]) == null ? void 0 : _a.call(handlers, data);
|
|
162
|
-
},
|
|
163
|
-
[object.id, state]
|
|
164
153
|
);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
154
|
+
const H = async (i) => {
|
|
155
|
+
const { data: a } = await (h ? h({ content: i, object: o }) : s.post("/comments", { content: i, object: o }));
|
|
156
|
+
M(d(a)), f?.(a);
|
|
157
|
+
}, j = () => /* @__PURE__ */ r(
|
|
158
|
+
we,
|
|
159
|
+
{
|
|
160
|
+
editorRef: y,
|
|
161
|
+
placeholder: S,
|
|
162
|
+
send: H,
|
|
163
|
+
draftKey: b || `object-${o.id}`,
|
|
164
|
+
autoFocus: w,
|
|
165
|
+
disabledSend: x,
|
|
166
|
+
initialContent: A,
|
|
167
|
+
sendText: v,
|
|
168
|
+
sendIcon: I,
|
|
169
|
+
renderInnerFooter: W,
|
|
170
|
+
onChange: R,
|
|
171
|
+
disableCmdEnter: O
|
|
173
172
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const renderCommentInput = () => {
|
|
180
|
-
return /* @__PURE__ */ jsx(
|
|
181
|
-
CommentInput,
|
|
173
|
+
);
|
|
174
|
+
return /* @__PURE__ */ m(Ee, { ref: e, children: [
|
|
175
|
+
/* @__PURE__ */ m(V, { children: [
|
|
176
|
+
/* @__PURE__ */ r(
|
|
177
|
+
p,
|
|
182
178
|
{
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
renderInnerFooter,
|
|
193
|
-
onChange: onInput,
|
|
194
|
-
disableCmdEnter
|
|
179
|
+
sx: {
|
|
180
|
+
display: "flex",
|
|
181
|
+
justifyContent: "space-between",
|
|
182
|
+
alignItems: "end"
|
|
183
|
+
},
|
|
184
|
+
children: n && /* @__PURE__ */ m(he, { sx: { alignItems: "flex-end" }, children: [
|
|
185
|
+
/* @__PURE__ */ r(be, { id: o.id, request: s, interactive: D }),
|
|
186
|
+
T
|
|
187
|
+
] })
|
|
195
188
|
}
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
showTopbar: true,
|
|
263
|
-
sendComment: null,
|
|
264
|
-
reactionAppend: null,
|
|
265
|
-
skeleton: null,
|
|
266
|
-
placeholder: "",
|
|
267
|
-
onInput: () => {
|
|
268
|
-
},
|
|
269
|
-
draftKey: "",
|
|
270
|
-
editorRef: null,
|
|
271
|
-
inputSx: {},
|
|
272
|
-
disableCmdEnter: false
|
|
189
|
+
),
|
|
190
|
+
k.user && D && C === "top" && /* @__PURE__ */ r(
|
|
191
|
+
p,
|
|
192
|
+
{
|
|
193
|
+
className: "comment-editor",
|
|
194
|
+
sx: {
|
|
195
|
+
mt: 2
|
|
196
|
+
},
|
|
197
|
+
children: j()
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] }),
|
|
201
|
+
!!E && P && /* @__PURE__ */ m(
|
|
202
|
+
p,
|
|
203
|
+
{
|
|
204
|
+
sx: {
|
|
205
|
+
display: "flex",
|
|
206
|
+
justifyContent: "space-between",
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
mt: 3
|
|
209
|
+
},
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ m(p, { sx: { fontWeight: "medium" }, children: [
|
|
212
|
+
E > 0 ? `${E} ${c("comments")}` : c("comment"),
|
|
213
|
+
" "
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ r(
|
|
216
|
+
ge,
|
|
217
|
+
{
|
|
218
|
+
value: z,
|
|
219
|
+
options: [
|
|
220
|
+
{ value: "desc", label: c("newest") },
|
|
221
|
+
{ value: "asc", label: c("oldest") }
|
|
222
|
+
],
|
|
223
|
+
onChange: (i) => L(i)
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
/* @__PURE__ */ r(ye, { className: "comment-list" }),
|
|
230
|
+
k.user && D && C === "bottom" && /* @__PURE__ */ r(p, { sx: { mt: 6, ...g }, children: j() })
|
|
231
|
+
] });
|
|
232
|
+
}
|
|
233
|
+
K.propTypes = {
|
|
234
|
+
ref: t.any,
|
|
235
|
+
displayReaction: t.bool,
|
|
236
|
+
object: t.object.isRequired,
|
|
237
|
+
onChange: t.func,
|
|
238
|
+
onSendComment: t.func,
|
|
239
|
+
disabledSend: t.bool,
|
|
240
|
+
autoFocus: t.bool,
|
|
241
|
+
initialContent: t.string,
|
|
242
|
+
sendText: t.string,
|
|
243
|
+
sendIcon: t.node,
|
|
244
|
+
commentInputPosition: t.oneOf(["top", "bottom"]),
|
|
245
|
+
showTopbar: t.bool,
|
|
246
|
+
sendComment: t.func,
|
|
247
|
+
reactionAppend: t.any,
|
|
248
|
+
skeleton: t.node,
|
|
249
|
+
placeholder: t.string,
|
|
250
|
+
onInput: t.func,
|
|
251
|
+
draftKey: t.string,
|
|
252
|
+
editorRef: t.object,
|
|
253
|
+
inputSx: t.object,
|
|
254
|
+
disableCmdEnter: t.bool
|
|
273
255
|
};
|
|
274
|
-
function
|
|
275
|
-
target,
|
|
276
|
-
flatView,
|
|
277
|
-
autoCollapse,
|
|
278
|
-
autoLoadComments,
|
|
279
|
-
order,
|
|
280
|
-
allowCopyLink,
|
|
281
|
-
showProfileCard,
|
|
282
|
-
interactive,
|
|
283
|
-
renderComments,
|
|
284
|
-
renderDonation,
|
|
285
|
-
renderActions,
|
|
286
|
-
renderEditorPlugins,
|
|
287
|
-
enableAutoTranslate,
|
|
288
|
-
renderInnerFooter,
|
|
289
|
-
|
|
256
|
+
function De({
|
|
257
|
+
target: e,
|
|
258
|
+
flatView: n = !1,
|
|
259
|
+
autoCollapse: o = !1,
|
|
260
|
+
autoLoadComments: l = !0,
|
|
261
|
+
order: f = void 0,
|
|
262
|
+
allowCopyLink: C = !1,
|
|
263
|
+
showProfileCard: w = !1,
|
|
264
|
+
interactive: x = !0,
|
|
265
|
+
renderComments: A = null,
|
|
266
|
+
renderDonation: v = null,
|
|
267
|
+
renderActions: I = null,
|
|
268
|
+
renderEditorPlugins: P = null,
|
|
269
|
+
enableAutoTranslate: h = !1,
|
|
270
|
+
renderInnerFooter: T = null,
|
|
271
|
+
...$
|
|
290
272
|
}) {
|
|
291
|
-
|
|
273
|
+
const S = Object.assign(
|
|
274
|
+
{},
|
|
275
|
+
{
|
|
276
|
+
displayReaction: !0,
|
|
277
|
+
onChange: () => {
|
|
278
|
+
},
|
|
279
|
+
onSendComment: () => {
|
|
280
|
+
},
|
|
281
|
+
disabledSend: void 0,
|
|
282
|
+
sendComment: null,
|
|
283
|
+
reactionAppend: null
|
|
284
|
+
},
|
|
285
|
+
$
|
|
286
|
+
);
|
|
287
|
+
if (!e?.id)
|
|
292
288
|
throw new Error("target is required.");
|
|
293
|
-
}
|
|
294
|
-
const { locale = "en" } = useLocaleContext() || {};
|
|
295
|
-
const containerRef = useRef();
|
|
296
|
-
const object = useMemo(
|
|
289
|
+
const { locale: R = "en" } = F() || {}, b = J(), g = Q(
|
|
297
290
|
() => ({
|
|
298
291
|
link: window.location.href,
|
|
299
|
-
blockletName:
|
|
300
|
-
...
|
|
292
|
+
blockletName: $e(),
|
|
293
|
+
...e
|
|
301
294
|
}),
|
|
302
295
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
303
|
-
[
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (wsClient.isConnected()) ;
|
|
310
|
-
};
|
|
311
|
-
}, []);
|
|
312
|
-
return /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, children: /* @__PURE__ */ jsx(LocaleProvider, { translations, locale, children: /* @__PURE__ */ jsx(UploaderProvider, { children: /* @__PURE__ */ jsx(InternalThemeProvider, { children: /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(DefaultEditorConfigProvider, { request: api, children: /* @__PURE__ */ jsx(
|
|
313
|
-
CommentsProvider,
|
|
296
|
+
[e]
|
|
297
|
+
), y = ae(Ie);
|
|
298
|
+
return X(() => (y.connect(), () => {
|
|
299
|
+
y.isConnected();
|
|
300
|
+
}), []), /* @__PURE__ */ r(se, { FallbackComponent: Ae, children: /* @__PURE__ */ r(ie, { translations: ve, locale: R, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r(ue, { request: s, children: /* @__PURE__ */ r(
|
|
301
|
+
me,
|
|
314
302
|
{
|
|
315
|
-
target:
|
|
316
|
-
api:
|
|
317
|
-
flatView,
|
|
318
|
-
order,
|
|
319
|
-
autoCollapse,
|
|
320
|
-
autoLoadComments,
|
|
321
|
-
allowCopyLink,
|
|
322
|
-
showProfileCard,
|
|
323
|
-
interactive,
|
|
324
|
-
containerRef,
|
|
325
|
-
renderDonation,
|
|
326
|
-
renderActions,
|
|
327
|
-
renderEditorPlugins,
|
|
328
|
-
enableAutoTranslate,
|
|
329
|
-
renderComments,
|
|
330
|
-
renderInnerFooter,
|
|
331
|
-
children: /* @__PURE__ */
|
|
303
|
+
target: g,
|
|
304
|
+
api: Se,
|
|
305
|
+
flatView: n,
|
|
306
|
+
order: f,
|
|
307
|
+
autoCollapse: o,
|
|
308
|
+
autoLoadComments: l,
|
|
309
|
+
allowCopyLink: C,
|
|
310
|
+
showProfileCard: w,
|
|
311
|
+
interactive: x,
|
|
312
|
+
containerRef: b,
|
|
313
|
+
renderDonation: v,
|
|
314
|
+
renderActions: I,
|
|
315
|
+
renderEditorPlugins: P,
|
|
316
|
+
enableAutoTranslate: h,
|
|
317
|
+
renderComments: A,
|
|
318
|
+
renderInnerFooter: T,
|
|
319
|
+
children: /* @__PURE__ */ r(K, { ...S, object: g, ref: b })
|
|
332
320
|
}
|
|
333
321
|
) }) }) }) }) }) });
|
|
334
322
|
}
|
|
335
|
-
|
|
336
|
-
target:
|
|
337
|
-
id:
|
|
338
|
-
title:
|
|
339
|
-
desc:
|
|
340
|
-
owner:
|
|
323
|
+
De.propTypes = {
|
|
324
|
+
target: t.shape({
|
|
325
|
+
id: t.string.isRequired,
|
|
326
|
+
title: t.string,
|
|
327
|
+
desc: t.string,
|
|
328
|
+
owner: t.string
|
|
341
329
|
}).isRequired,
|
|
342
|
-
displayReaction:
|
|
343
|
-
onChange:
|
|
344
|
-
flatView:
|
|
345
|
-
autoCollapse:
|
|
346
|
-
autoLoadComments:
|
|
347
|
-
allowCopyLink:
|
|
348
|
-
disabledSend:
|
|
349
|
-
showProfileCard:
|
|
350
|
-
order:
|
|
351
|
-
interactive:
|
|
352
|
-
renderComments:
|
|
353
|
-
renderDonation:
|
|
354
|
-
renderActions:
|
|
355
|
-
renderEditorPlugins:
|
|
356
|
-
enableAutoTranslate:
|
|
357
|
-
renderInnerFooter:
|
|
358
|
-
sendComment:
|
|
359
|
-
reactionAppend:
|
|
360
|
-
};
|
|
361
|
-
Wrapper.defaultProps = {
|
|
362
|
-
displayReaction: true,
|
|
363
|
-
onChange: () => {
|
|
364
|
-
},
|
|
365
|
-
flatView: false,
|
|
366
|
-
autoCollapse: false,
|
|
367
|
-
autoLoadComments: true,
|
|
368
|
-
allowCopyLink: false,
|
|
369
|
-
disabledSend: void 0,
|
|
370
|
-
showProfileCard: false,
|
|
371
|
-
order: void 0,
|
|
372
|
-
interactive: true,
|
|
373
|
-
renderComments: null,
|
|
374
|
-
renderDonation: null,
|
|
375
|
-
renderActions: null,
|
|
376
|
-
renderEditorPlugins: null,
|
|
377
|
-
enableAutoTranslate: false,
|
|
378
|
-
renderInnerFooter: null,
|
|
379
|
-
sendComment: null,
|
|
380
|
-
reactionAppend: null
|
|
330
|
+
displayReaction: t.bool,
|
|
331
|
+
onChange: t.func,
|
|
332
|
+
flatView: t.bool,
|
|
333
|
+
autoCollapse: t.bool,
|
|
334
|
+
autoLoadComments: t.bool,
|
|
335
|
+
allowCopyLink: t.bool,
|
|
336
|
+
disabledSend: t.bool,
|
|
337
|
+
showProfileCard: t.bool,
|
|
338
|
+
order: t.oneOf(["asc", "desc"]),
|
|
339
|
+
interactive: t.bool,
|
|
340
|
+
renderComments: t.func,
|
|
341
|
+
renderDonation: t.any,
|
|
342
|
+
renderActions: t.func,
|
|
343
|
+
renderEditorPlugins: t.func,
|
|
344
|
+
enableAutoTranslate: t.bool,
|
|
345
|
+
renderInnerFooter: t.func,
|
|
346
|
+
sendComment: t.func,
|
|
347
|
+
reactionAppend: t.any
|
|
381
348
|
};
|
|
382
|
-
const
|
|
349
|
+
const Ee = ee("div")`
|
|
383
350
|
width: 100%;
|
|
384
351
|
margin: 0 auto;
|
|
385
352
|
box-sizing: border-box;
|
|
386
|
-
padding: ${(
|
|
387
|
-
border: ${(
|
|
353
|
+
padding: ${(e) => e.padding ? "20px" : "0"};
|
|
354
|
+
border: ${(e) => e.border ? "1px solid rgb(208, 215, 222)" : "none"};
|
|
388
355
|
border-radius: 6px;
|
|
389
356
|
`;
|
|
390
357
|
export {
|
|
391
|
-
|
|
358
|
+
De as default
|
|
392
359
|
};
|