@blocklet/discuss-kit-ux 1.6.189 → 1.6.192
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.
|
@@ -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-QT05VtkX.mjs";
|
|
8
8
|
import "@blocklet/labels";
|
|
9
9
|
import "@mui/material/styles";
|
|
10
10
|
import "@mui/material/Box";
|
|
@@ -518,7 +518,7 @@ const Input = ({
|
|
|
518
518
|
...editorConfig,
|
|
519
519
|
...inSmallView && {
|
|
520
520
|
toolbar: {
|
|
521
|
-
items: ["block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
521
|
+
items: ["component", "block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
};
|
|
@@ -1089,7 +1089,16 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
);
|
|
1091
1091
|
}
|
|
1092
|
-
const HtmlTooltip$1 = styled(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1092
|
+
const HtmlTooltip$1 = styled(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1093
|
+
Tooltip,
|
|
1094
|
+
{
|
|
1095
|
+
PopperProps: {
|
|
1096
|
+
disablePortal: true
|
|
1097
|
+
},
|
|
1098
|
+
...props,
|
|
1099
|
+
classes: { popper: className }
|
|
1100
|
+
}
|
|
1101
|
+
))(() => ({
|
|
1093
1102
|
[`& .${tooltipClasses.tooltip}`]: {
|
|
1094
1103
|
backgroundColor: "transparent",
|
|
1095
1104
|
maxWidth: "initial"
|
|
@@ -1191,10 +1200,11 @@ function AuthorInfo({
|
|
|
1191
1200
|
);
|
|
1192
1201
|
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize }, ...rest, children: [
|
|
1193
1202
|
renderAvatar(),
|
|
1194
|
-
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
1203
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
1195
1204
|
/* @__PURE__ */ jsxs(
|
|
1196
1205
|
Box,
|
|
1197
1206
|
{
|
|
1207
|
+
className: "author-info-title",
|
|
1198
1208
|
sx: { display: "flex", alignItems: "center", minHeight: 20, flexWrap: "wrap", lineHeight: 1.5 },
|
|
1199
1209
|
lineHeight: 1,
|
|
1200
1210
|
children: [
|
|
@@ -2127,36 +2137,34 @@ function Comment({
|
|
|
2127
2137
|
};
|
|
2128
2138
|
const render = ({ post, interactive }) => {
|
|
2129
2139
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
)
|
|
2159
|
-
] }),
|
|
2140
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsx(
|
|
2141
|
+
GithubReaction,
|
|
2142
|
+
{
|
|
2143
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2144
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2145
|
+
onUnrate: () => onUnrate(post),
|
|
2146
|
+
interactive,
|
|
2147
|
+
append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
|
|
2148
|
+
Box,
|
|
2149
|
+
{
|
|
2150
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2151
|
+
sx: {
|
|
2152
|
+
display: "flex",
|
|
2153
|
+
alignItems: "center",
|
|
2154
|
+
gap: 0.75,
|
|
2155
|
+
fontSize: 13,
|
|
2156
|
+
color: "text.secondary",
|
|
2157
|
+
lineHeight: 1,
|
|
2158
|
+
"&:hover": { cursor: "pointer" }
|
|
2159
|
+
},
|
|
2160
|
+
children: [
|
|
2161
|
+
/* @__PURE__ */ jsx(Box, { component: tablerMessageCircle, sx: { fontSize: 18, color: "text.secondary" } }),
|
|
2162
|
+
/* @__PURE__ */ jsx(Box, { component: "span", children: "Reply" })
|
|
2163
|
+
]
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
}
|
|
2167
|
+
) }),
|
|
2160
2168
|
inputVisible && /* @__PURE__ */ jsx(Box, { my: 2, children: /* @__PURE__ */ jsx(
|
|
2161
2169
|
CommentInput,
|
|
2162
2170
|
{
|
|
@@ -3873,6 +3881,9 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
|
|
|
3873
3881
|
}
|
|
3874
3882
|
}
|
|
3875
3883
|
};
|
|
3884
|
+
const renderPostContent = () => {
|
|
3885
|
+
return /* @__PURE__ */ jsx(Box, { className: "author-chat-item", children: /* @__PURE__ */ jsx(PostContent, { content: message.content }) });
|
|
3886
|
+
};
|
|
3876
3887
|
const menuItems = [];
|
|
3877
3888
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
3878
3889
|
const messageDate = new Date(message.createdAt);
|
|
@@ -3900,10 +3911,18 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
|
|
|
3900
3911
|
display: "flex !important"
|
|
3901
3912
|
}
|
|
3902
3913
|
},
|
|
3914
|
+
".author-info-title": {
|
|
3915
|
+
fontSize: 14,
|
|
3916
|
+
fontWeight: 500
|
|
3917
|
+
},
|
|
3918
|
+
".author-chat-item": {
|
|
3919
|
+
ml: compactMessage ? 6 : 0,
|
|
3920
|
+
width: "90%"
|
|
3921
|
+
},
|
|
3903
3922
|
...{
|
|
3904
3923
|
".be-editable": {
|
|
3905
3924
|
"& > *:last-child": {
|
|
3906
|
-
|
|
3925
|
+
mb: "0 !important"
|
|
3907
3926
|
}
|
|
3908
3927
|
}
|
|
3909
3928
|
}
|
|
@@ -3924,17 +3943,21 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
|
|
|
3924
3943
|
}
|
|
3925
3944
|
}
|
|
3926
3945
|
),
|
|
3927
|
-
!compactMessage
|
|
3946
|
+
!compactMessage ? /* @__PURE__ */ jsx(
|
|
3928
3947
|
AuthorInfo,
|
|
3929
3948
|
{
|
|
3930
3949
|
showBadge: false,
|
|
3931
3950
|
showProfileCard: true,
|
|
3951
|
+
showDID: false,
|
|
3932
3952
|
user: message.sender,
|
|
3933
3953
|
createdAt: showTime ? message.createdAt : void 0,
|
|
3934
|
-
size: "sm"
|
|
3954
|
+
size: "sm",
|
|
3955
|
+
style: {
|
|
3956
|
+
alignItems: "flex-start"
|
|
3957
|
+
},
|
|
3958
|
+
children: renderPostContent()
|
|
3935
3959
|
}
|
|
3936
|
-
)
|
|
3937
|
-
/* @__PURE__ */ jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsx(PostContent, { content: message.content }) })
|
|
3960
|
+
) : renderPostContent()
|
|
3938
3961
|
]
|
|
3939
3962
|
}
|
|
3940
3963
|
);
|
|
@@ -4226,6 +4249,7 @@ function MessageList({ chat, ...rest }) {
|
|
|
4226
4249
|
const isActive = isActiveChat(chat.id);
|
|
4227
4250
|
const containerRef = useRef(null);
|
|
4228
4251
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
4252
|
+
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
4229
4253
|
const scrollToBottom = () => {
|
|
4230
4254
|
var _a3, _b3;
|
|
4231
4255
|
(_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
|
|
@@ -4263,7 +4287,23 @@ function MessageList({ chat, ...rest }) {
|
|
|
4263
4287
|
py: 2.5,
|
|
4264
4288
|
px: 1.25,
|
|
4265
4289
|
gap: 1,
|
|
4266
|
-
background: "rgba(249, 250, 251, 1)"
|
|
4290
|
+
background: "rgba(249, 250, 251, 1)",
|
|
4291
|
+
// 闪烁
|
|
4292
|
+
"@keyframes blinking": {
|
|
4293
|
+
"0%": { opacity: 0 },
|
|
4294
|
+
"50%": { opacity: 1 },
|
|
4295
|
+
"100%": { opacity: 0 }
|
|
4296
|
+
},
|
|
4297
|
+
// 渐变显示
|
|
4298
|
+
"@keyframes fade-in": {
|
|
4299
|
+
"0%": { opacity: 0 },
|
|
4300
|
+
"100%": { opacity: 1 }
|
|
4301
|
+
},
|
|
4302
|
+
// 用于弱化消息渲染闪烁
|
|
4303
|
+
".message-item": {
|
|
4304
|
+
animation: "fade-in 0.2s linear",
|
|
4305
|
+
animationIterationCount: 1
|
|
4306
|
+
}
|
|
4267
4307
|
},
|
|
4268
4308
|
ref: containerRef,
|
|
4269
4309
|
children: [
|
|
@@ -4275,32 +4315,37 @@ function MessageList({ chat, ...rest }) {
|
|
|
4275
4315
|
display: "flex",
|
|
4276
4316
|
justifyContent: "center",
|
|
4277
4317
|
py: 0.5,
|
|
4278
|
-
|
|
4279
|
-
"@keyframes fade-in": {
|
|
4280
|
-
"0%": { opacity: 0 },
|
|
4281
|
-
"50%": { opacity: 1 },
|
|
4282
|
-
"100%": { opacity: 0 }
|
|
4283
|
-
}
|
|
4318
|
+
height: 40
|
|
4284
4319
|
},
|
|
4285
4320
|
children: /* @__PURE__ */ jsx(
|
|
4286
|
-
|
|
4321
|
+
LoadingButton,
|
|
4287
4322
|
{
|
|
4288
4323
|
variant: "text",
|
|
4289
4324
|
color: "inherit",
|
|
4325
|
+
loadingPosition: "start",
|
|
4326
|
+
loading: isLoadingMore,
|
|
4290
4327
|
onClick: async () => {
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4328
|
+
var _a3, _b3;
|
|
4329
|
+
try {
|
|
4330
|
+
setIsLoadingMore(true);
|
|
4331
|
+
const firstChatId = (_b3 = (_a3 = chat.messages) == null ? void 0 : _a3[0]) == null ? void 0 : _b3.id;
|
|
4332
|
+
const firstChatMessage = document.getElementById(firstChatId);
|
|
4294
4333
|
const divider = document.createElement("div");
|
|
4295
|
-
divider.style.animation = "
|
|
4334
|
+
divider.style.animation = "blinking 1s linear";
|
|
4296
4335
|
divider.style.animationIterationCount = "5";
|
|
4297
4336
|
divider.style.borderTop = "1px solid #e5e5e5";
|
|
4298
4337
|
divider.style.opacity = "0";
|
|
4299
4338
|
divider.style.height = "0";
|
|
4300
|
-
|
|
4301
|
-
(
|
|
4302
|
-
|
|
4303
|
-
|
|
4339
|
+
await loadMessages(chat.id, chat.nextCursor);
|
|
4340
|
+
setTimeout(() => {
|
|
4341
|
+
var _a4, _b4;
|
|
4342
|
+
(_a4 = containerRef.current) == null ? void 0 : _a4.insertBefore(divider, firstChatMessage);
|
|
4343
|
+
(_b4 = containerRef.current) == null ? void 0 : _b4.scrollTo({ top: divider.offsetTop - 40 - 16 - 1 });
|
|
4344
|
+
}, 20);
|
|
4345
|
+
} catch (error) {
|
|
4346
|
+
} finally {
|
|
4347
|
+
setIsLoadingMore(false);
|
|
4348
|
+
}
|
|
4304
4349
|
},
|
|
4305
4350
|
startIcon: /* @__PURE__ */ jsx(ArrowUpward, {}),
|
|
4306
4351
|
children: t("chat.loadMore")
|
|
@@ -4311,12 +4356,12 @@ function MessageList({ chat, ...rest }) {
|
|
|
4311
4356
|
chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
|
|
4312
4357
|
var _a3;
|
|
4313
4358
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4314
|
-
return /* @__PURE__ */ jsx(Box, { id: message.id, children: /* @__PURE__ */ jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4359
|
+
return /* @__PURE__ */ jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4315
4360
|
})),
|
|
4316
4361
|
chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
|
|
4317
4362
|
var _a3;
|
|
4318
4363
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4319
|
-
return /* @__PURE__ */ jsx(Box, { id: message.id, children: /* @__PURE__ */ jsx(
|
|
4364
|
+
return /* @__PURE__ */ jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsx(
|
|
4320
4365
|
NotificationMessage,
|
|
4321
4366
|
{
|
|
4322
4367
|
chat,
|
|
@@ -5129,7 +5174,7 @@ function Pagination({
|
|
|
5129
5174
|
}
|
|
5130
5175
|
);
|
|
5131
5176
|
}
|
|
5132
|
-
const Editor = lazy(() => import("./editor-
|
|
5177
|
+
const Editor = lazy(() => import("./editor-Mvl3hnJk.mjs"));
|
|
5133
5178
|
function LazyEditor(props) {
|
|
5134
5179
|
const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5135
5180
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { O, k, T, A, j, a9, B, z, H, F, J, al, W, U, X, Z, q, C, v, w, y, a1, a2, ad, a4, L, N, D, ac, ab, E, G, b, h, aa, M, P, ak, o, n, a8, R, S, a5, am, m, _, a0, ae, ah, ag, ai, an, K, ao, l, p, r, f, t, a6, Q, c, Y, x, a3, a7, u, aj, d, ap, $, af, e } from "./index-
|
|
2
|
+
import { O, k, T, A, j, a9, B, z, H, F, J, al, W, U, X, Z, q, C, v, w, y, a1, a2, ad, a4, L, N, D, ac, ab, E, G, b, h, aa, M, P, ak, o, n, a8, R, S, a5, am, m, _, a0, ae, ah, ag, ai, an, K, ao, l, p, r, f, t, a6, Q, c, Y, x, a3, a7, u, aj, d, ap, $, af, e } from "./index-QT05VtkX.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -451,7 +451,7 @@ var __publicField = (obj, key, value) => {
|
|
|
451
451
|
...editorConfig,
|
|
452
452
|
...inSmallView && {
|
|
453
453
|
toolbar: {
|
|
454
|
-
items: ["block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
454
|
+
items: ["component", "block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
};
|
|
@@ -1022,7 +1022,16 @@ var __publicField = (obj, key, value) => {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
);
|
|
1024
1024
|
}
|
|
1025
|
-
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1025
|
+
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
+
Tooltip,
|
|
1027
|
+
{
|
|
1028
|
+
PopperProps: {
|
|
1029
|
+
disablePortal: true
|
|
1030
|
+
},
|
|
1031
|
+
...props,
|
|
1032
|
+
classes: { popper: className }
|
|
1033
|
+
}
|
|
1034
|
+
))(() => ({
|
|
1026
1035
|
[`& .${Tooltip.tooltipClasses.tooltip}`]: {
|
|
1027
1036
|
backgroundColor: "transparent",
|
|
1028
1037
|
maxWidth: "initial"
|
|
@@ -1124,10 +1133,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1124
1133
|
);
|
|
1125
1134
|
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize }, ...rest, children: [
|
|
1126
1135
|
renderAvatar(),
|
|
1127
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
1136
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
1128
1137
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1129
1138
|
Box,
|
|
1130
1139
|
{
|
|
1140
|
+
className: "author-info-title",
|
|
1131
1141
|
sx: { display: "flex", alignItems: "center", minHeight: 20, flexWrap: "wrap", lineHeight: 1.5 },
|
|
1132
1142
|
lineHeight: 1,
|
|
1133
1143
|
children: [
|
|
@@ -2060,36 +2070,34 @@ var __publicField = (obj, key, value) => {
|
|
|
2060
2070
|
};
|
|
2061
2071
|
const render = ({ post, interactive }) => {
|
|
2062
2072
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2063
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
)
|
|
2092
|
-
] }),
|
|
2073
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2074
|
+
GithubReaction,
|
|
2075
|
+
{
|
|
2076
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2077
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2078
|
+
onUnrate: () => onUnrate(post),
|
|
2079
|
+
interactive,
|
|
2080
|
+
append: (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2081
|
+
Box,
|
|
2082
|
+
{
|
|
2083
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2084
|
+
sx: {
|
|
2085
|
+
display: "flex",
|
|
2086
|
+
alignItems: "center",
|
|
2087
|
+
gap: 0.75,
|
|
2088
|
+
fontSize: 13,
|
|
2089
|
+
color: "text.secondary",
|
|
2090
|
+
lineHeight: 1,
|
|
2091
|
+
"&:hover": { cursor: "pointer" }
|
|
2092
|
+
},
|
|
2093
|
+
children: [
|
|
2094
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerMessageCircle, sx: { fontSize: 18, color: "text.secondary" } }),
|
|
2095
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
|
|
2096
|
+
]
|
|
2097
|
+
}
|
|
2098
|
+
)
|
|
2099
|
+
}
|
|
2100
|
+
) }),
|
|
2093
2101
|
inputVisible && /* @__PURE__ */ jsxRuntime.jsx(Box, { my: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2094
2102
|
CommentInput,
|
|
2095
2103
|
{
|
|
@@ -3806,6 +3814,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3806
3814
|
}
|
|
3807
3815
|
}
|
|
3808
3816
|
};
|
|
3817
|
+
const renderPostContent = () => {
|
|
3818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "author-chat-item", children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) });
|
|
3819
|
+
};
|
|
3809
3820
|
const menuItems = [];
|
|
3810
3821
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
3811
3822
|
const messageDate = new Date(message.createdAt);
|
|
@@ -3833,10 +3844,18 @@ var __publicField = (obj, key, value) => {
|
|
|
3833
3844
|
display: "flex !important"
|
|
3834
3845
|
}
|
|
3835
3846
|
},
|
|
3847
|
+
".author-info-title": {
|
|
3848
|
+
fontSize: 14,
|
|
3849
|
+
fontWeight: 500
|
|
3850
|
+
},
|
|
3851
|
+
".author-chat-item": {
|
|
3852
|
+
ml: compactMessage ? 6 : 0,
|
|
3853
|
+
width: "90%"
|
|
3854
|
+
},
|
|
3836
3855
|
...{
|
|
3837
3856
|
".be-editable": {
|
|
3838
3857
|
"& > *:last-child": {
|
|
3839
|
-
|
|
3858
|
+
mb: "0 !important"
|
|
3840
3859
|
}
|
|
3841
3860
|
}
|
|
3842
3861
|
}
|
|
@@ -3857,17 +3876,21 @@ var __publicField = (obj, key, value) => {
|
|
|
3857
3876
|
}
|
|
3858
3877
|
}
|
|
3859
3878
|
),
|
|
3860
|
-
!compactMessage
|
|
3879
|
+
!compactMessage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3861
3880
|
AuthorInfo,
|
|
3862
3881
|
{
|
|
3863
3882
|
showBadge: false,
|
|
3864
3883
|
showProfileCard: true,
|
|
3884
|
+
showDID: false,
|
|
3865
3885
|
user: message.sender,
|
|
3866
3886
|
createdAt: showTime ? message.createdAt : void 0,
|
|
3867
|
-
size: "sm"
|
|
3887
|
+
size: "sm",
|
|
3888
|
+
style: {
|
|
3889
|
+
alignItems: "flex-start"
|
|
3890
|
+
},
|
|
3891
|
+
children: renderPostContent()
|
|
3868
3892
|
}
|
|
3869
|
-
)
|
|
3870
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) })
|
|
3893
|
+
) : renderPostContent()
|
|
3871
3894
|
]
|
|
3872
3895
|
}
|
|
3873
3896
|
);
|
|
@@ -4159,6 +4182,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4159
4182
|
const isActive = isActiveChat(chat.id);
|
|
4160
4183
|
const containerRef = react.useRef(null);
|
|
4161
4184
|
const [isAtBottom, setIsAtBottom] = react.useState(true);
|
|
4185
|
+
const [isLoadingMore, setIsLoadingMore] = react.useState(false);
|
|
4162
4186
|
const scrollToBottom = () => {
|
|
4163
4187
|
var _a3, _b3;
|
|
4164
4188
|
(_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
|
|
@@ -4196,7 +4220,23 @@ var __publicField = (obj, key, value) => {
|
|
|
4196
4220
|
py: 2.5,
|
|
4197
4221
|
px: 1.25,
|
|
4198
4222
|
gap: 1,
|
|
4199
|
-
background: "rgba(249, 250, 251, 1)"
|
|
4223
|
+
background: "rgba(249, 250, 251, 1)",
|
|
4224
|
+
// 闪烁
|
|
4225
|
+
"@keyframes blinking": {
|
|
4226
|
+
"0%": { opacity: 0 },
|
|
4227
|
+
"50%": { opacity: 1 },
|
|
4228
|
+
"100%": { opacity: 0 }
|
|
4229
|
+
},
|
|
4230
|
+
// 渐变显示
|
|
4231
|
+
"@keyframes fade-in": {
|
|
4232
|
+
"0%": { opacity: 0 },
|
|
4233
|
+
"100%": { opacity: 1 }
|
|
4234
|
+
},
|
|
4235
|
+
// 用于弱化消息渲染闪烁
|
|
4236
|
+
".message-item": {
|
|
4237
|
+
animation: "fade-in 0.2s linear",
|
|
4238
|
+
animationIterationCount: 1
|
|
4239
|
+
}
|
|
4200
4240
|
},
|
|
4201
4241
|
ref: containerRef,
|
|
4202
4242
|
children: [
|
|
@@ -4208,32 +4248,37 @@ var __publicField = (obj, key, value) => {
|
|
|
4208
4248
|
display: "flex",
|
|
4209
4249
|
justifyContent: "center",
|
|
4210
4250
|
py: 0.5,
|
|
4211
|
-
|
|
4212
|
-
"@keyframes fade-in": {
|
|
4213
|
-
"0%": { opacity: 0 },
|
|
4214
|
-
"50%": { opacity: 1 },
|
|
4215
|
-
"100%": { opacity: 0 }
|
|
4216
|
-
}
|
|
4251
|
+
height: 40
|
|
4217
4252
|
},
|
|
4218
4253
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4219
|
-
|
|
4254
|
+
LoadingButton,
|
|
4220
4255
|
{
|
|
4221
4256
|
variant: "text",
|
|
4222
4257
|
color: "inherit",
|
|
4258
|
+
loadingPosition: "start",
|
|
4259
|
+
loading: isLoadingMore,
|
|
4223
4260
|
onClick: async () => {
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4261
|
+
var _a3, _b3;
|
|
4262
|
+
try {
|
|
4263
|
+
setIsLoadingMore(true);
|
|
4264
|
+
const firstChatId = (_b3 = (_a3 = chat.messages) == null ? void 0 : _a3[0]) == null ? void 0 : _b3.id;
|
|
4265
|
+
const firstChatMessage = document.getElementById(firstChatId);
|
|
4227
4266
|
const divider = document.createElement("div");
|
|
4228
|
-
divider.style.animation = "
|
|
4267
|
+
divider.style.animation = "blinking 1s linear";
|
|
4229
4268
|
divider.style.animationIterationCount = "5";
|
|
4230
4269
|
divider.style.borderTop = "1px solid #e5e5e5";
|
|
4231
4270
|
divider.style.opacity = "0";
|
|
4232
4271
|
divider.style.height = "0";
|
|
4233
|
-
|
|
4234
|
-
(
|
|
4235
|
-
|
|
4236
|
-
|
|
4272
|
+
await loadMessages(chat.id, chat.nextCursor);
|
|
4273
|
+
setTimeout(() => {
|
|
4274
|
+
var _a4, _b4;
|
|
4275
|
+
(_a4 = containerRef.current) == null ? void 0 : _a4.insertBefore(divider, firstChatMessage);
|
|
4276
|
+
(_b4 = containerRef.current) == null ? void 0 : _b4.scrollTo({ top: divider.offsetTop - 40 - 16 - 1 });
|
|
4277
|
+
}, 20);
|
|
4278
|
+
} catch (error) {
|
|
4279
|
+
} finally {
|
|
4280
|
+
setIsLoadingMore(false);
|
|
4281
|
+
}
|
|
4237
4282
|
},
|
|
4238
4283
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpward, {}),
|
|
4239
4284
|
children: t("chat.loadMore")
|
|
@@ -4244,12 +4289,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4244
4289
|
chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
|
|
4245
4290
|
var _a3;
|
|
4246
4291
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4247
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4248
4293
|
})),
|
|
4249
4294
|
chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
|
|
4250
4295
|
var _a3;
|
|
4251
4296
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4252
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4297
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4253
4298
|
NotificationMessage,
|
|
4254
4299
|
{
|
|
4255
4300
|
chat,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.192",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@arcblock/ws": "^1.18.113",
|
|
32
|
-
"@blocklet/editor": "1.6.
|
|
33
|
-
"@blocklet/labels": "1.6.
|
|
32
|
+
"@blocklet/editor": "1.6.192",
|
|
33
|
+
"@blocklet/labels": "1.6.192",
|
|
34
34
|
"@blocklet/uploader": "^0.0.75",
|
|
35
35
|
"@emotion/css": "^11.10.5",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"resolutions": {
|
|
95
95
|
"react": "^18.2.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "3c34fa4bd4f854452af6a5d9c434dd4774ed7381"
|
|
98
98
|
}
|