@blocklet/discuss-kit 2.1.238 → 2.1.239
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/comments.js +21 -6
- package/lib/es/comments.js +21 -6
- package/package.json +3 -3
package/lib/cjs/comments.js
CHANGED
|
@@ -120,7 +120,11 @@ const DiscussKitComments = react.forwardRef(
|
|
|
120
120
|
sendIcon,
|
|
121
121
|
showTopbar,
|
|
122
122
|
sendComment,
|
|
123
|
-
reactionAppend
|
|
123
|
+
reactionAppend,
|
|
124
|
+
skeleton,
|
|
125
|
+
placeholder,
|
|
126
|
+
onInput,
|
|
127
|
+
draftKey
|
|
124
128
|
}, ref) => {
|
|
125
129
|
discussKitUx.useDefaultApiErrorHandler({
|
|
126
130
|
request: api
|
|
@@ -172,7 +176,7 @@ const DiscussKitComments = react.forwardRef(
|
|
|
172
176
|
] });
|
|
173
177
|
}
|
|
174
178
|
if (!initialized) {
|
|
175
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, {}) });
|
|
179
|
+
return skeleton || /* @__PURE__ */ jsxRuntime.jsx(material.Box, { width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, {}) });
|
|
176
180
|
}
|
|
177
181
|
const handleSendComment = async (content) => {
|
|
178
182
|
const { data } = await (sendComment ? sendComment({ content, object }) : api.post("/comments", { content, object }));
|
|
@@ -197,14 +201,16 @@ const DiscussKitComments = react.forwardRef(
|
|
|
197
201
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
198
202
|
discussKitUx.CommentInput,
|
|
199
203
|
{
|
|
204
|
+
placeholder,
|
|
200
205
|
send: handleSendComment,
|
|
201
|
-
draftKey: `object-${object.id}`,
|
|
206
|
+
draftKey: draftKey || `object-${object.id}`,
|
|
202
207
|
autoFocus,
|
|
203
208
|
disabledSend,
|
|
204
209
|
initialContent,
|
|
205
210
|
sendText,
|
|
206
211
|
sendIcon,
|
|
207
|
-
renderInnerFooter
|
|
212
|
+
renderInnerFooter,
|
|
213
|
+
onChange: onInput
|
|
208
214
|
}
|
|
209
215
|
);
|
|
210
216
|
};
|
|
@@ -266,7 +272,11 @@ DiscussKitComments.propTypes = {
|
|
|
266
272
|
commentInputPosition: PropTypes.oneOf(["top", "bottom"]),
|
|
267
273
|
showTopbar: PropTypes.bool,
|
|
268
274
|
sendComment: PropTypes.func,
|
|
269
|
-
reactionAppend: PropTypes.any
|
|
275
|
+
reactionAppend: PropTypes.any,
|
|
276
|
+
skeleton: PropTypes.node,
|
|
277
|
+
placeholder: PropTypes.string,
|
|
278
|
+
onInput: PropTypes.func,
|
|
279
|
+
draftKey: PropTypes.string
|
|
270
280
|
};
|
|
271
281
|
DiscussKitComments.defaultProps = {
|
|
272
282
|
displayConnectButton: false,
|
|
@@ -283,7 +293,12 @@ DiscussKitComments.defaultProps = {
|
|
|
283
293
|
commentInputPosition: "top",
|
|
284
294
|
showTopbar: true,
|
|
285
295
|
sendComment: null,
|
|
286
|
-
reactionAppend: null
|
|
296
|
+
reactionAppend: null,
|
|
297
|
+
skeleton: null,
|
|
298
|
+
placeholder: "",
|
|
299
|
+
onInput: () => {
|
|
300
|
+
},
|
|
301
|
+
draftKey: ""
|
|
287
302
|
};
|
|
288
303
|
function Wrapper({
|
|
289
304
|
target,
|
package/lib/es/comments.js
CHANGED
|
@@ -119,7 +119,11 @@ const DiscussKitComments = forwardRef(
|
|
|
119
119
|
sendIcon,
|
|
120
120
|
showTopbar,
|
|
121
121
|
sendComment,
|
|
122
|
-
reactionAppend
|
|
122
|
+
reactionAppend,
|
|
123
|
+
skeleton,
|
|
124
|
+
placeholder,
|
|
125
|
+
onInput,
|
|
126
|
+
draftKey
|
|
123
127
|
}, ref) => {
|
|
124
128
|
useDefaultApiErrorHandler({
|
|
125
129
|
request: api
|
|
@@ -171,7 +175,7 @@ const DiscussKitComments = forwardRef(
|
|
|
171
175
|
] });
|
|
172
176
|
}
|
|
173
177
|
if (!initialized) {
|
|
174
|
-
return /* @__PURE__ */ jsx(Box, { width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ jsx(CircularProgress, {}) });
|
|
178
|
+
return skeleton || /* @__PURE__ */ jsx(Box, { width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ jsx(CircularProgress, {}) });
|
|
175
179
|
}
|
|
176
180
|
const handleSendComment = async (content) => {
|
|
177
181
|
const { data } = await (sendComment ? sendComment({ content, object }) : api.post("/comments", { content, object }));
|
|
@@ -196,14 +200,16 @@ const DiscussKitComments = forwardRef(
|
|
|
196
200
|
return /* @__PURE__ */ jsx(
|
|
197
201
|
CommentInput,
|
|
198
202
|
{
|
|
203
|
+
placeholder,
|
|
199
204
|
send: handleSendComment,
|
|
200
|
-
draftKey: `object-${object.id}`,
|
|
205
|
+
draftKey: draftKey || `object-${object.id}`,
|
|
201
206
|
autoFocus,
|
|
202
207
|
disabledSend,
|
|
203
208
|
initialContent,
|
|
204
209
|
sendText,
|
|
205
210
|
sendIcon,
|
|
206
|
-
renderInnerFooter
|
|
211
|
+
renderInnerFooter,
|
|
212
|
+
onChange: onInput
|
|
207
213
|
}
|
|
208
214
|
);
|
|
209
215
|
};
|
|
@@ -265,7 +271,11 @@ DiscussKitComments.propTypes = {
|
|
|
265
271
|
commentInputPosition: PropTypes.oneOf(["top", "bottom"]),
|
|
266
272
|
showTopbar: PropTypes.bool,
|
|
267
273
|
sendComment: PropTypes.func,
|
|
268
|
-
reactionAppend: PropTypes.any
|
|
274
|
+
reactionAppend: PropTypes.any,
|
|
275
|
+
skeleton: PropTypes.node,
|
|
276
|
+
placeholder: PropTypes.string,
|
|
277
|
+
onInput: PropTypes.func,
|
|
278
|
+
draftKey: PropTypes.string
|
|
269
279
|
};
|
|
270
280
|
DiscussKitComments.defaultProps = {
|
|
271
281
|
displayConnectButton: false,
|
|
@@ -282,7 +292,12 @@ DiscussKitComments.defaultProps = {
|
|
|
282
292
|
commentInputPosition: "top",
|
|
283
293
|
showTopbar: true,
|
|
284
294
|
sendComment: null,
|
|
285
|
-
reactionAppend: null
|
|
295
|
+
reactionAppend: null,
|
|
296
|
+
skeleton: null,
|
|
297
|
+
placeholder: "",
|
|
298
|
+
onInput: () => {
|
|
299
|
+
},
|
|
300
|
+
draftKey: ""
|
|
286
301
|
};
|
|
287
302
|
function Wrapper({
|
|
288
303
|
target,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.239",
|
|
4
4
|
"description": "A react component for Discuss Kit blocklet.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/es/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"rehype-sanitize": "^5.0.1",
|
|
50
50
|
"timeago.js": "^4.0.2",
|
|
51
51
|
"url-join": "^4.0.1",
|
|
52
|
-
"@blocklet/discuss-kit-ux": "^2.1.
|
|
53
|
-
"@blocklet/editor": "^2.1.
|
|
52
|
+
"@blocklet/discuss-kit-ux": "^2.1.239",
|
|
53
|
+
"@blocklet/editor": "^2.1.239"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@arcblock/did-connect": "^2.10.36",
|