@blocklet/discuss-kit 1.0.37 → 1.0.39
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 +5 -0
- package/lib/cjs/comments.js +9 -1
- package/lib/es/api.js +5 -0
- package/lib/es/comments.js +10 -2
- package/package.json +7 -7
package/lib/cjs/api.js
CHANGED
|
@@ -38,8 +38,13 @@ const fetchMoreReplies = async ({ commentId, cursor, limit = 10 }) => {
|
|
|
38
38
|
throw e;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
const getMentions = async (text) => {
|
|
42
|
+
const { data } = await request.get(`/mention?search=${text}`);
|
|
43
|
+
return data;
|
|
44
|
+
};
|
|
41
45
|
exports.default = request;
|
|
42
46
|
exports.fetchComments = fetchComments;
|
|
43
47
|
exports.fetchMoreReplies = fetchMoreReplies;
|
|
44
48
|
exports.fetchRatingStats = fetchRatingStats;
|
|
49
|
+
exports.getMentions = getMentions;
|
|
45
50
|
exports.reply = reply;
|
package/lib/cjs/comments.js
CHANGED
|
@@ -323,7 +323,15 @@ function Wrapper({
|
|
|
323
323
|
react.useEffect(() => {
|
|
324
324
|
setSettings((prev) => ({
|
|
325
325
|
...prev,
|
|
326
|
-
autoCollapse
|
|
326
|
+
autoCollapse,
|
|
327
|
+
async mentionSearch(text) {
|
|
328
|
+
const data = await api.getMentions(text);
|
|
329
|
+
return data.map((e) => ({
|
|
330
|
+
picture: e.avatar,
|
|
331
|
+
name: e.fullName,
|
|
332
|
+
data: e.did
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
327
335
|
}));
|
|
328
336
|
}, [autoCollapse, setSettings]);
|
|
329
337
|
const object = react.useMemo(
|
package/lib/es/api.js
CHANGED
|
@@ -34,10 +34,15 @@ const fetchMoreReplies = async ({ commentId, cursor, limit = 10 }) => {
|
|
|
34
34
|
throw e;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
const getMentions = async (text) => {
|
|
38
|
+
const { data } = await request.get(`/mention?search=${text}`);
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
37
41
|
export {
|
|
38
42
|
request as default,
|
|
39
43
|
fetchComments,
|
|
40
44
|
fetchMoreReplies,
|
|
41
45
|
fetchRatingStats,
|
|
46
|
+
getMentions,
|
|
42
47
|
reply
|
|
43
48
|
};
|
package/lib/es/comments.js
CHANGED
|
@@ -15,7 +15,7 @@ import { useCommentSettings, InternalThemeProvider, UploadProvider, CommentsProv
|
|
|
15
15
|
import ErrorFallback from "./components/error-fallback";
|
|
16
16
|
import { translations } from "./locales";
|
|
17
17
|
import getWsClient, { useSubscription } from "./ws";
|
|
18
|
-
import api, { fetchRatingStats } from "./api";
|
|
18
|
+
import api, { getMentions, fetchRatingStats } from "./api";
|
|
19
19
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
20
20
|
const getPrefix = () => {
|
|
21
21
|
var _a, _b;
|
|
@@ -310,7 +310,15 @@ function Wrapper({
|
|
|
310
310
|
useEffect(() => {
|
|
311
311
|
setSettings((prev) => ({
|
|
312
312
|
...prev,
|
|
313
|
-
autoCollapse
|
|
313
|
+
autoCollapse,
|
|
314
|
+
async mentionSearch(text) {
|
|
315
|
+
const data = await getMentions(text);
|
|
316
|
+
return data.map((e) => ({
|
|
317
|
+
picture: e.avatar,
|
|
318
|
+
name: e.fullName,
|
|
319
|
+
data: e.did
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
314
322
|
}));
|
|
315
323
|
}, [autoCollapse, setSettings]);
|
|
316
324
|
const object = useMemo(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "A react component for Discuss Kit blocklet.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/es/index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"author": "Nate <nate@arcblock.io> (http://github.com/NateRobinson)",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@arcblock/did-connect": "^2.4.
|
|
38
|
-
"@arcblock/ux": "^2.4.
|
|
39
|
-
"@arcblock/ws": "^1.18.
|
|
40
|
-
"@blocklet/discuss-kit-ux": "1.0.
|
|
41
|
-
"@blocklet/editor": "1.0.
|
|
37
|
+
"@arcblock/did-connect": "^2.4.64",
|
|
38
|
+
"@arcblock/ux": "^2.4.64",
|
|
39
|
+
"@arcblock/ws": "^1.18.34",
|
|
40
|
+
"@blocklet/discuss-kit-ux": "1.0.39",
|
|
41
|
+
"@blocklet/editor": "1.0.39",
|
|
42
42
|
"@emotion/react": "^11.10.5",
|
|
43
43
|
"@emotion/styled": "^11.10.5",
|
|
44
44
|
"@mui/icons-material": "^5.10.9",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"vite-plugin-build": "^0.6.0",
|
|
78
78
|
"vite-plugin-svgr": "^2.2.2"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "f0a84bd8d5dd971d9a31ccd4908ec70f3c2f9206"
|
|
81
81
|
}
|