@logora/debate 0.4.103 → 0.4.104
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.
|
@@ -1,197 +1,222 @@
|
|
|
1
|
-
import { jsx as o, jsxs as l, Fragment as
|
|
2
|
-
import { buildShareUrl as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { buildShareUrl as be } from "../../tools/share_url/index.js";
|
|
3
|
+
import { readPendingReply as Ie, clearPendingReply as Re } from "../../util/pending_reply/pendingReply.js";
|
|
4
|
+
import G from "classnames";
|
|
5
|
+
import { useState as p, useRef as V, useEffect as H, useCallback as Se, Suspense as Me, lazy as ve } from "react";
|
|
6
|
+
import { useIntl as Ce } from "react-intl";
|
|
6
7
|
import s from "./Argument.module.scss.js";
|
|
7
|
-
import { ReplyFooter as
|
|
8
|
-
import { useRichContent as
|
|
9
|
-
import { useAuth as
|
|
10
|
-
import { useConfig as
|
|
11
|
-
import { useList as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
8
|
+
import { ReplyFooter as Te } from "./ReplyFooter.js";
|
|
9
|
+
import { useRichContent as Ne } from "./useRichContent.js";
|
|
10
|
+
import { useAuth as we } from "../../auth/use_auth/useAuth.js";
|
|
11
|
+
import { useConfig as xe } from "../../data/config_provider/useConfig.js";
|
|
12
|
+
import { useList as Ae } from "../../list/list_provider/useList.js";
|
|
13
|
+
import { useDataProvider as Le } from "../../data/data_provider/useDataProvider.js";
|
|
14
|
+
import { useTranslatedContent as O } from "../../translation/translated_content/useTranslatedContent.js";
|
|
15
|
+
import { SourceListItem as Ue } from "../../source/source_list_item/SourceListItem.js";
|
|
16
|
+
import { HashScroll as Pe } from "../../tools/hash_scroll/HashScroll.js";
|
|
17
|
+
import { ContentHeader as ke } from "../../user_content/content_header/ContentHeader.js";
|
|
18
|
+
import { Icon as z } from "../../icons/icon/Icon.js";
|
|
19
|
+
import { ReadMore as Be } from "../../text/read_more/ReadMore.js";
|
|
20
|
+
import { TranslationButton as $e } from "../../translation/translation_button/TranslationButton.js";
|
|
21
|
+
import { ContentFooter as Ee } from "../../user_content/content_footer/ContentFooter.js";
|
|
22
|
+
import { VoteButton as De } from "../../vote/vote_button/VoteButton.js";
|
|
23
|
+
import { VotePaginatedList as Fe } from "../../list/paginated_list/VotePaginatedList.js";
|
|
24
|
+
import { UserContentSkeleton as je } from "../../skeleton/user_content_skeleton/UserContentSkeleton.js";
|
|
25
|
+
import { Button as Ge } from "../../action/button/Button.js";
|
|
26
|
+
const Ve = ve(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), Y = (e) => e?.replace(/ /g, " "), He = ({
|
|
25
27
|
argument: e,
|
|
26
|
-
argumentReplies:
|
|
27
|
-
nestingLevel:
|
|
28
|
-
maxNestingLevel:
|
|
29
|
-
groupType:
|
|
30
|
-
groupName:
|
|
31
|
-
positions:
|
|
32
|
-
disableLinks:
|
|
33
|
-
parentArgument:
|
|
34
|
-
flashParent:
|
|
35
|
-
expandable:
|
|
36
|
-
disabled:
|
|
37
|
-
hideFooter:
|
|
38
|
-
hideReplies:
|
|
39
|
-
vote:
|
|
40
|
-
fixedContentHeight:
|
|
41
|
-
enableEdition:
|
|
42
|
-
enableDeletion:
|
|
43
|
-
deleteListId:
|
|
44
|
-
showModerationFeedback:
|
|
45
|
-
lineCount:
|
|
46
|
-
replyRedirectUrl:
|
|
47
|
-
hideContent:
|
|
28
|
+
argumentReplies: d,
|
|
29
|
+
nestingLevel: I = 0,
|
|
30
|
+
maxNestingLevel: N = 2,
|
|
31
|
+
groupType: w,
|
|
32
|
+
groupName: x,
|
|
33
|
+
positions: R = [],
|
|
34
|
+
disableLinks: q = !1,
|
|
35
|
+
parentArgument: u,
|
|
36
|
+
flashParent: J,
|
|
37
|
+
expandable: K,
|
|
38
|
+
disabled: S = !1,
|
|
39
|
+
hideFooter: A = !1,
|
|
40
|
+
hideReplies: L,
|
|
41
|
+
vote: Q,
|
|
42
|
+
fixedContentHeight: W = !1,
|
|
43
|
+
enableEdition: X = !0,
|
|
44
|
+
enableDeletion: Z = !0,
|
|
45
|
+
deleteListId: ee,
|
|
46
|
+
showModerationFeedback: te,
|
|
47
|
+
lineCount: oe = 5,
|
|
48
|
+
replyRedirectUrl: se,
|
|
49
|
+
hideContent: re = !1,
|
|
50
|
+
ancestorIds: U = []
|
|
48
51
|
}) => {
|
|
49
|
-
const a =
|
|
52
|
+
const a = Ce(), { isLoggedIn: m, currentUser: f } = we(), M = f?.moderation_status === "banned", i = xe(), ie = Ae(), ne = Le(), [h, c] = p(!1), [ae, P] = p(!1), [le, k] = p(!1), [de, ce] = p(!1), B = Ne(e), [g, y] = p(), $ = V(null), E = V(!1), _ = O(
|
|
50
53
|
e.content,
|
|
51
54
|
e.language,
|
|
52
55
|
"content",
|
|
53
56
|
e.translation_entries
|
|
54
|
-
),
|
|
57
|
+
), pe = O(
|
|
55
58
|
e.position?.name,
|
|
56
59
|
e.position?.language,
|
|
57
60
|
"name",
|
|
58
61
|
e.position?.translation_entries
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
62
|
+
), v = `argument_${e.id}`, C = e.position && R?.map((t) => t.id).indexOf(e.position.id) + 1;
|
|
63
|
+
H(() => {
|
|
64
|
+
d !== void 0 && ye();
|
|
65
|
+
}, [d]);
|
|
66
|
+
const ue = (t) => {
|
|
67
|
+
t && ne.getOne("messages", t).then((r) => {
|
|
68
|
+
const n = r?.data?.data?.resource;
|
|
69
|
+
n && (y(
|
|
70
|
+
(T) => T?.some((_e) => String(_e.id) === String(n.id)) ? T : [...T || [], n]
|
|
71
|
+
), c(!0));
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
});
|
|
74
|
+
}, me = (t) => {
|
|
75
|
+
const r = $.current;
|
|
76
|
+
!r || E.current || (E.current = !0, t?.some((n) => String(n.id) === String(r)) || ue(r));
|
|
77
|
+
};
|
|
78
|
+
H(() => {
|
|
79
|
+
if (!m)
|
|
80
|
+
return;
|
|
81
|
+
const t = Ie();
|
|
82
|
+
if (!t || String(t.groupId) !== String(e.group_id))
|
|
83
|
+
return;
|
|
84
|
+
const r = (t.ancestorIds || []).map(String), n = r.indexOf(String(e.id));
|
|
85
|
+
n >= 0 && (c(!0), $.current = r[n + 1] || null), String(t.parentId) === String(e.id) && (c(!0), k(!0), ce(!0), Re());
|
|
86
|
+
}, [m]);
|
|
87
|
+
const fe = (t) => {
|
|
88
|
+
if (v === t) {
|
|
89
|
+
const n = document.getElementById(t);
|
|
90
|
+
n && n.scrollIntoView({ behavior: "smooth" }), P(!0);
|
|
67
91
|
}
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
if (!
|
|
92
|
+
}, D = () => {
|
|
93
|
+
k((t) => !t);
|
|
94
|
+
}, F = () => {
|
|
95
|
+
c((t) => !t), y([]);
|
|
96
|
+
}, he = (t) => {
|
|
97
|
+
if (!g?.find((r) => r.id === t.id))
|
|
74
98
|
return t;
|
|
75
|
-
},
|
|
76
|
-
|
|
99
|
+
}, ge = Se((t, r) => /* @__PURE__ */ o(
|
|
100
|
+
Ue,
|
|
77
101
|
{
|
|
78
102
|
publisher: t.publisher,
|
|
79
103
|
url: t.source_url,
|
|
80
104
|
title: t.title,
|
|
81
|
-
index:
|
|
105
|
+
index: r
|
|
82
106
|
},
|
|
83
|
-
|
|
84
|
-
), []),
|
|
85
|
-
if (
|
|
86
|
-
const t =
|
|
87
|
-
(
|
|
107
|
+
r
|
|
108
|
+
), []), ye = () => {
|
|
109
|
+
if (d && Array.isArray(d)) {
|
|
110
|
+
const t = d.filter(
|
|
111
|
+
(r) => r.reply_to_id === e.id
|
|
88
112
|
);
|
|
89
|
-
t.length > 0 && (
|
|
113
|
+
t.length > 0 && (y(t), c(!0));
|
|
90
114
|
}
|
|
91
|
-
},
|
|
92
|
-
|
|
115
|
+
}, j = (t = null) => /* @__PURE__ */ o(
|
|
116
|
+
Oe,
|
|
93
117
|
{
|
|
94
118
|
...t ? { argument: t } : {},
|
|
95
|
-
nestingLevel:
|
|
96
|
-
maxNestingLevel:
|
|
97
|
-
disabled:
|
|
98
|
-
groupName:
|
|
99
|
-
groupType:
|
|
100
|
-
positions:
|
|
101
|
-
argumentReplies:
|
|
119
|
+
nestingLevel: I + 1,
|
|
120
|
+
maxNestingLevel: N,
|
|
121
|
+
disabled: S,
|
|
122
|
+
groupName: x,
|
|
123
|
+
groupType: w,
|
|
124
|
+
positions: R,
|
|
125
|
+
argumentReplies: d,
|
|
102
126
|
parentArgument: e,
|
|
103
|
-
flashParent: (
|
|
127
|
+
flashParent: (r) => fe(`argument_${r}`),
|
|
128
|
+
ancestorIds: [...U, e.id]
|
|
104
129
|
}
|
|
105
130
|
);
|
|
106
|
-
return /* @__PURE__ */ l(
|
|
131
|
+
return /* @__PURE__ */ l(Pe, { elementId: v, onScroll: () => P(!0), children: [
|
|
107
132
|
/* @__PURE__ */ l(
|
|
108
133
|
"div",
|
|
109
134
|
{
|
|
110
|
-
className:
|
|
135
|
+
className: G(
|
|
111
136
|
s.argument,
|
|
112
137
|
{
|
|
113
|
-
[s.flash]:
|
|
138
|
+
[s.flash]: ae,
|
|
114
139
|
[s.argumentReply]: e.is_reply === !0
|
|
115
140
|
},
|
|
116
|
-
s[`level-${
|
|
117
|
-
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") &&
|
|
141
|
+
s[`level-${I}`],
|
|
142
|
+
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && C}`]
|
|
118
143
|
),
|
|
119
|
-
id:
|
|
144
|
+
id: v,
|
|
120
145
|
children: [
|
|
121
146
|
/* @__PURE__ */ o(
|
|
122
|
-
|
|
147
|
+
ke,
|
|
123
148
|
{
|
|
124
149
|
selectedContent: e.is_selected,
|
|
125
150
|
author: e.author,
|
|
126
|
-
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null :
|
|
151
|
+
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : pe.translatedContent,
|
|
127
152
|
date: e.created_at,
|
|
128
|
-
tagClassName: s[`headerPosition-${
|
|
129
|
-
disableLinks:
|
|
153
|
+
tagClassName: s[`headerPosition-${C}`],
|
|
154
|
+
disableLinks: q,
|
|
130
155
|
isDeleted: e.is_deleted,
|
|
131
|
-
showModerationFeedback:
|
|
156
|
+
showModerationFeedback: te ?? (e.status === "rejected" && i.moderation?.showFeedback === !0),
|
|
132
157
|
moderationReason: e.moderation_entry?.moderation_reason,
|
|
133
158
|
moderationNotes: e.moderation_entry?.moderator_notes,
|
|
134
|
-
moderationPolicyUrl:
|
|
159
|
+
moderationPolicyUrl: i.provider?.userGuideUrl
|
|
135
160
|
}
|
|
136
161
|
),
|
|
137
162
|
e.is_deleted ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
|
|
138
163
|
id: "info.deleted_by_user",
|
|
139
164
|
defaultMessage: "Content deleted by the user"
|
|
140
|
-
}) }) :
|
|
165
|
+
}) }) : re ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
|
|
141
166
|
id: "argument.argument.content_deleted",
|
|
142
167
|
defaultMessage: "This content has been removed."
|
|
143
|
-
}) }) : /* @__PURE__ */ l(
|
|
168
|
+
}) }) : /* @__PURE__ */ l(b, { children: [
|
|
144
169
|
/* @__PURE__ */ l(
|
|
145
170
|
"div",
|
|
146
171
|
{
|
|
147
|
-
className:
|
|
148
|
-
[s.fixedHeight]:
|
|
172
|
+
className: G(s.argumentBody, {
|
|
173
|
+
[s.fixedHeight]: i?.layout?.showAllArgumentInEmbed !== !0 ? W : !1
|
|
149
174
|
}),
|
|
150
175
|
children: [
|
|
151
|
-
e.is_reply &&
|
|
176
|
+
e.is_reply && u && /* @__PURE__ */ l(
|
|
152
177
|
"div",
|
|
153
178
|
{
|
|
154
179
|
className: s.replyTo,
|
|
155
|
-
onClick: () =>
|
|
180
|
+
onClick: () => J(u.id),
|
|
156
181
|
children: [
|
|
157
182
|
a.formatMessage({
|
|
158
183
|
id: "info.replying_to",
|
|
159
184
|
defaultMessage: "Replying to"
|
|
160
185
|
}),
|
|
161
186
|
/* @__PURE__ */ l("span", { className: s.replyingTo, children: [
|
|
162
|
-
|
|
187
|
+
u.is_deleted ? a.formatMessage({
|
|
163
188
|
id: "info.deleted",
|
|
164
189
|
defaultMessage: "Deleted"
|
|
165
|
-
}) :
|
|
166
|
-
/* @__PURE__ */ o(
|
|
190
|
+
}) : u.author.full_name,
|
|
191
|
+
/* @__PURE__ */ o(z, { name: "chat", height: 16 })
|
|
167
192
|
] })
|
|
168
193
|
]
|
|
169
194
|
}
|
|
170
195
|
),
|
|
171
196
|
/* @__PURE__ */ o(
|
|
172
|
-
|
|
197
|
+
Be,
|
|
173
198
|
{
|
|
174
|
-
content: /* @__PURE__ */ l(
|
|
199
|
+
content: /* @__PURE__ */ l(b, { children: [
|
|
175
200
|
e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: a.formatMessage({
|
|
176
201
|
id: "argument.argument.updated",
|
|
177
202
|
defaultMessage: "Updated argument"
|
|
178
203
|
}) }),
|
|
179
|
-
|
|
204
|
+
B && !_.isTranslated ? /* @__PURE__ */ o(
|
|
180
205
|
"div",
|
|
181
206
|
{
|
|
182
207
|
className: s.argumentContent,
|
|
183
|
-
dangerouslySetInnerHTML: { __html:
|
|
208
|
+
dangerouslySetInnerHTML: { __html: Y(B) }
|
|
184
209
|
}
|
|
185
|
-
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children:
|
|
186
|
-
|
|
187
|
-
|
|
210
|
+
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: Y(_.translatedContent) }),
|
|
211
|
+
_.isTranslated && /* @__PURE__ */ o(
|
|
212
|
+
$e,
|
|
188
213
|
{
|
|
189
214
|
language: e.language,
|
|
190
|
-
callback: () =>
|
|
215
|
+
callback: () => _.toggleContent()
|
|
191
216
|
}
|
|
192
217
|
)
|
|
193
218
|
] }),
|
|
194
|
-
lineCount:
|
|
219
|
+
lineCount: i?.layout?.showAllArgumentInEmbed !== !0 ? oe : void 0,
|
|
195
220
|
readMoreText: a.formatMessage({
|
|
196
221
|
id: "action.read_more",
|
|
197
222
|
defaultMessage: "Read more"
|
|
@@ -200,29 +225,29 @@ const we = pe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
200
225
|
id: "action.read_less",
|
|
201
226
|
defaultMessage: "Read less"
|
|
202
227
|
}),
|
|
203
|
-
expandable:
|
|
228
|
+
expandable: i?.layout?.showAllArgumentInEmbed !== !0 ? K : !1,
|
|
204
229
|
readMoreClassName: e.is_reply ? s.replyStyle : s.argumentStyle
|
|
205
230
|
}
|
|
206
231
|
)
|
|
207
232
|
]
|
|
208
233
|
}
|
|
209
234
|
),
|
|
210
|
-
e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(
|
|
235
|
+
e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(ge) })
|
|
211
236
|
] }),
|
|
212
|
-
!
|
|
213
|
-
|
|
237
|
+
!A && !e.is_deleted && /* @__PURE__ */ o(
|
|
238
|
+
Ee,
|
|
214
239
|
{
|
|
215
240
|
resource: e,
|
|
216
|
-
disabled:
|
|
217
|
-
disableEdition: e.status === "rejected" || !
|
|
241
|
+
disabled: S || e.status === "rejected" || e.status === "pending" || !m && i?.actions?.disableInputForVisitor === !0 || M,
|
|
242
|
+
disableEdition: e.status === "rejected" || !m && i?.actions?.disableInputForVisitor === !0 || M,
|
|
218
243
|
reportType: "Message",
|
|
219
|
-
softDelete:
|
|
244
|
+
softDelete: i.actions?.softDelete,
|
|
220
245
|
deleteType: "messages",
|
|
221
|
-
deleteListId:
|
|
222
|
-
enableReply:
|
|
223
|
-
handleReplyTo:
|
|
224
|
-
replyRedirectUrl:
|
|
225
|
-
shareUrl:
|
|
246
|
+
deleteListId: ee,
|
|
247
|
+
enableReply: I <= N || f.role === "editor" || f.role === "moderator",
|
|
248
|
+
handleReplyTo: D,
|
|
249
|
+
replyRedirectUrl: se,
|
|
250
|
+
shareUrl: be(i, "a", e.id),
|
|
226
251
|
shareTitle: a.formatMessage({
|
|
227
252
|
id: "share.argument.title",
|
|
228
253
|
defaultMessage: "Share a debate"
|
|
@@ -231,81 +256,83 @@ const we = pe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
231
256
|
id: "share.argument.text",
|
|
232
257
|
defaultMessage: "This argument may interest you"
|
|
233
258
|
}),
|
|
234
|
-
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${
|
|
235
|
-
showShareCode:
|
|
259
|
+
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${i.shortname}&id=${e.id}&resource=argument" frameborder="0" width="100%" height="275px" scrolling="no"></iframe>`,
|
|
260
|
+
showShareCode: i?.actions?.hideCodeShare !== !0,
|
|
236
261
|
showShareText: !0,
|
|
237
|
-
showShareButton:
|
|
262
|
+
showShareButton: i?.actions?.hideShareButton !== !0,
|
|
238
263
|
enableReport: !(e.score === 100 && e.manual_score),
|
|
239
|
-
enableEdition:
|
|
240
|
-
enableDeletion:
|
|
264
|
+
enableEdition: X,
|
|
265
|
+
enableDeletion: Z,
|
|
241
266
|
children: /* @__PURE__ */ o(
|
|
242
|
-
|
|
267
|
+
De,
|
|
243
268
|
{
|
|
244
269
|
voteableType: "Message",
|
|
245
270
|
voteableId: e.id,
|
|
246
271
|
totalUpvote: e.upvotes,
|
|
247
272
|
totalDownvote: 0,
|
|
248
|
-
activeClassName: s[`voteButtonPosition-${
|
|
249
|
-
disabled: e.status === "rejected" ||
|
|
273
|
+
activeClassName: s[`voteButtonPosition-${C}`],
|
|
274
|
+
disabled: e.status === "rejected" || f?.id === e?.author?.id || M
|
|
250
275
|
}
|
|
251
276
|
)
|
|
252
277
|
}
|
|
253
278
|
),
|
|
254
|
-
!
|
|
255
|
-
|
|
279
|
+
!A && !L && /* @__PURE__ */ o(
|
|
280
|
+
Te,
|
|
256
281
|
{
|
|
257
282
|
numberReplies: e.number_replies,
|
|
258
283
|
repliesAuthors: e.replies_authors,
|
|
259
|
-
expandReplies:
|
|
260
|
-
onToggleReplies:
|
|
284
|
+
expandReplies: h,
|
|
285
|
+
onToggleReplies: F,
|
|
261
286
|
isReply: e.is_reply
|
|
262
287
|
}
|
|
263
288
|
)
|
|
264
289
|
]
|
|
265
290
|
}
|
|
266
291
|
),
|
|
267
|
-
!
|
|
268
|
-
|
|
269
|
-
|
|
292
|
+
!L && /* @__PURE__ */ l(b, { children: [
|
|
293
|
+
le && /* @__PURE__ */ o(Me, { fallback: null, children: /* @__PURE__ */ o(
|
|
294
|
+
Ve,
|
|
270
295
|
{
|
|
271
296
|
groupId: e.group_id,
|
|
272
|
-
groupType:
|
|
273
|
-
groupName:
|
|
274
|
-
positions:
|
|
297
|
+
groupType: w,
|
|
298
|
+
groupName: x,
|
|
299
|
+
positions: R,
|
|
275
300
|
parentId: e.id,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
301
|
+
ancestorIds: [...U, e.id],
|
|
302
|
+
positionId: Q?.position_id,
|
|
303
|
+
disabled: S,
|
|
304
|
+
hideSourceAction: i?.actions?.disableUserSources || !1,
|
|
279
305
|
onSubmit: (t) => {
|
|
280
|
-
const
|
|
281
|
-
|
|
306
|
+
const r = `argument_${e.id}_reply_list`;
|
|
307
|
+
ie.add(r, [t]), D(), c(!0);
|
|
282
308
|
},
|
|
283
309
|
onUpdate: (t) => {
|
|
284
|
-
|
|
285
|
-
(
|
|
286
|
-
(
|
|
310
|
+
y(
|
|
311
|
+
(r) => r?.map(
|
|
312
|
+
(n) => n.id === t.id ? { ...n, ...t } : n
|
|
287
313
|
)
|
|
288
314
|
);
|
|
289
315
|
},
|
|
290
316
|
isReply: !0,
|
|
291
317
|
autoFocus: !0,
|
|
318
|
+
focusOnInit: de,
|
|
292
319
|
avatarSize: 40,
|
|
293
320
|
placeholder: a.formatMessage({
|
|
294
321
|
id: "input.reply_input.your_answer",
|
|
295
322
|
defaultMessage: "Your answer"
|
|
296
323
|
}),
|
|
297
|
-
userGuideUrl:
|
|
298
|
-
hideUserGuideLink:
|
|
324
|
+
userGuideUrl: i?.provider?.userGuideUrl,
|
|
325
|
+
hideUserGuideLink: i?.provider?.hideUserGuideLink
|
|
299
326
|
},
|
|
300
327
|
`Reply${e.id}`
|
|
301
328
|
) }),
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
329
|
+
g?.length > 0 && h && /* @__PURE__ */ o("div", { className: s.repliesList, children: g.map((t) => j(t)) }),
|
|
330
|
+
h && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
|
|
331
|
+
Fe,
|
|
305
332
|
{
|
|
306
333
|
voteableType: "Message",
|
|
307
334
|
currentListId: `argument_${e.id}_reply_list`,
|
|
308
|
-
loadingComponent: /* @__PURE__ */ o(
|
|
335
|
+
loadingComponent: /* @__PURE__ */ o(je, {}),
|
|
309
336
|
resource: "messages",
|
|
310
337
|
sort: "+created_at",
|
|
311
338
|
filters: {
|
|
@@ -316,17 +343,18 @@ const we = pe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
316
343
|
perPage: 5,
|
|
317
344
|
display: "column",
|
|
318
345
|
resourcePropName: "argument",
|
|
319
|
-
emptyListComponent: /* @__PURE__ */ o(
|
|
320
|
-
|
|
321
|
-
|
|
346
|
+
emptyListComponent: /* @__PURE__ */ o(b, {}),
|
|
347
|
+
onElementsLoad: me,
|
|
348
|
+
transformData: (t) => he(t),
|
|
349
|
+
children: j(e)
|
|
322
350
|
}
|
|
323
351
|
) }),
|
|
324
|
-
|
|
325
|
-
|
|
352
|
+
g?.length > 0 && !h && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
|
|
353
|
+
Ge,
|
|
326
354
|
{
|
|
327
355
|
role: "link",
|
|
328
|
-
rightIcon: /* @__PURE__ */ o(
|
|
329
|
-
handleClick:
|
|
356
|
+
rightIcon: /* @__PURE__ */ o(z, { name: "lightArrow", height: 10, width: 10 }),
|
|
357
|
+
handleClick: F,
|
|
330
358
|
children: a.formatMessage({
|
|
331
359
|
id: "argument.argument.see_more",
|
|
332
360
|
defaultMessage: "See more"
|
|
@@ -335,8 +363,8 @@ const we = pe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
335
363
|
) }) })
|
|
336
364
|
] })
|
|
337
365
|
] });
|
|
338
|
-
},
|
|
366
|
+
}, Oe = He;
|
|
339
367
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
368
|
+
He as Argument,
|
|
369
|
+
Oe as ArgumentContainer
|
|
342
370
|
};
|
|
@@ -1,115 +1,117 @@
|
|
|
1
|
-
import { jsxs as C, jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as C, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { storePendingReply as je } from "../../util/pending_reply/pendingReply.js";
|
|
3
|
+
import { useRef as ze, useState as u, useEffect as M, Suspense as Oe, lazy as Re } from "react";
|
|
4
|
+
import { useIntl as Je, FormattedMessage as he } from "react-intl";
|
|
5
|
+
import { useLocation as Ke } from "react-router";
|
|
6
|
+
import I from "classnames";
|
|
6
7
|
import n from "./ArgumentInput.module.scss.js";
|
|
7
|
-
import { useDataProvider as
|
|
8
|
-
import { useList as
|
|
9
|
-
import { useConfig as
|
|
10
|
-
import { useInput as
|
|
11
|
-
import { useAuth as
|
|
12
|
-
import { useFormValidation as
|
|
13
|
-
import { useResponsive as
|
|
14
|
-
import { useScrollToEditor as
|
|
15
|
-
import { useSessionStorageState as
|
|
16
|
-
import { useAuthRequired as
|
|
17
|
-
import { useModal as
|
|
18
|
-
import { useToast as
|
|
19
|
-
import { TogglePosition as
|
|
20
|
-
import { Avatar as
|
|
21
|
-
import { AuthorBox as
|
|
22
|
-
import { TextEditor as
|
|
23
|
-
import { Icon as
|
|
24
|
-
const
|
|
8
|
+
import { useDataProvider as Ge } from "../../data/data_provider/useDataProvider.js";
|
|
9
|
+
import { useList as He } from "../../list/list_provider/useList.js";
|
|
10
|
+
import { useConfig as Qe } from "../../data/config_provider/useConfig.js";
|
|
11
|
+
import { useInput as Xe } from "../input_provider/useInput.js";
|
|
12
|
+
import { useAuth as Ze } from "../../auth/use_auth/useAuth.js";
|
|
13
|
+
import { useFormValidation as et } from "../../forms/use_form_validation/useFormValidation.js";
|
|
14
|
+
import { useResponsive as tt } from "../../hooks/use_responsive/useResponsive.js";
|
|
15
|
+
import { useScrollToEditor as nt } from "../use_scroll_to_editor/useScrollToEditor.js";
|
|
16
|
+
import { useSessionStorageState as at } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
|
|
17
|
+
import { useAuthRequired as it } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
18
|
+
import { useModal as st } from "../../dialog/modal/useModal.js";
|
|
19
|
+
import { useToast as ot } from "../../dialog/toast_provider/useToast.js";
|
|
20
|
+
import { TogglePosition as rt } from "../toggle_position/TogglePosition.js";
|
|
21
|
+
import { Avatar as ut } from "../../user/avatar/Avatar.js";
|
|
22
|
+
import { AuthorBox as dt } from "../../user/author_box/AuthorBox.js";
|
|
23
|
+
import { TextEditor as lt } from "../text_editor/TextEditor.js";
|
|
24
|
+
import { Icon as ct } from "../../icons/icon/Icon.js";
|
|
25
|
+
const mt = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), qt = ({
|
|
25
26
|
argumentListId: N,
|
|
26
27
|
avatarSize: pe = 48,
|
|
27
|
-
disabled:
|
|
28
|
+
disabled: R = !1,
|
|
28
29
|
positions: a = [],
|
|
29
30
|
disabledPositions: T = [],
|
|
30
|
-
groupId:
|
|
31
|
+
groupId: f,
|
|
31
32
|
groupName: _e,
|
|
32
|
-
groupType:
|
|
33
|
+
groupType: J,
|
|
33
34
|
hideSourceAction: Me = !1,
|
|
34
|
-
isReply:
|
|
35
|
-
onSubmit:
|
|
35
|
+
isReply: s = !1,
|
|
36
|
+
onSubmit: K,
|
|
36
37
|
onUpdate: G,
|
|
37
|
-
parentId:
|
|
38
|
-
|
|
38
|
+
parentId: m,
|
|
39
|
+
ancestorIds: ve = [],
|
|
40
|
+
placeholder: be,
|
|
39
41
|
positionId: w,
|
|
40
|
-
focusOnInit:
|
|
42
|
+
focusOnInit: Ae = !1,
|
|
41
43
|
activeOnInit: P = !1,
|
|
42
44
|
userGuideUrl: H,
|
|
43
|
-
hideUserGuideLink:
|
|
44
|
-
hideCharCount:
|
|
45
|
-
disableAutoActivate:
|
|
45
|
+
hideUserGuideLink: Ce = !1,
|
|
46
|
+
hideCharCount: we = !1,
|
|
47
|
+
disableAutoActivate: Se = !1,
|
|
46
48
|
autoFocus: Q = !1
|
|
47
49
|
}) => {
|
|
48
|
-
const r =
|
|
50
|
+
const r = Je(), X = Ge(), y = He(), v = Qe(), {
|
|
49
51
|
focus: Z,
|
|
50
52
|
setFocus: ee,
|
|
51
53
|
inputContent: B,
|
|
52
54
|
setInputContent: te,
|
|
53
|
-
setInputRichContent:
|
|
54
|
-
} =
|
|
55
|
+
setInputRichContent: xe
|
|
56
|
+
} = Xe(), { isLoggedIn: S, currentUser: d } = Ze(), { errors: E, validate: $ } = et(), { isMobile: g } = tt(), Ie = Ke(), ne = ze(null), L = nt(ne), [V, q] = u([]), [D, U] = u(""), [ae, W] = u(null), [l, b] = u(null), [ie, se] = u(null), [oe, re] = u(!1), [x, ue] = u(!1), [A, de] = u({}), [Ne, Y] = u(!1), [Te, ye] = u(0), [h, Le] = at(
|
|
55
57
|
"userSide",
|
|
56
58
|
{}
|
|
57
|
-
), [
|
|
59
|
+
), [p, Fe] = u(
|
|
58
60
|
!S && v?.actions?.disableInputForVisitor
|
|
59
|
-
), k =
|
|
61
|
+
), k = it(), { showModal: Pe } = st(), { toast: j } = ot() || {}, le = new URLSearchParams(
|
|
60
62
|
typeof window < "u" ? window.location.search : Ie.search
|
|
61
63
|
);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
M(() => {
|
|
65
|
+
Fe(
|
|
64
66
|
!S && v?.actions?.disableInputForVisitor
|
|
65
67
|
);
|
|
66
68
|
}, [S, v]);
|
|
67
69
|
const z = d?.role === "editor" || d?.role === "moderator", ce = d?.moderation_status === "banned";
|
|
68
|
-
|
|
70
|
+
M(() => {
|
|
69
71
|
let e = null;
|
|
70
|
-
typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) :
|
|
71
|
-
}, [w]),
|
|
72
|
+
typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : h && h.groupId == f && h.positionId != a[2]?.id && b(h.positionId);
|
|
73
|
+
}, [w]), M(() => {
|
|
72
74
|
Q && Y(!0);
|
|
73
|
-
}, [Q]),
|
|
74
|
-
P && (O(), Y(!0),
|
|
75
|
-
}, [P]),
|
|
75
|
+
}, [Q]), M(() => {
|
|
76
|
+
P && (O(), Y(!0), L());
|
|
77
|
+
}, [P]), M(() => {
|
|
76
78
|
if (typeof window < "u") {
|
|
77
|
-
const e =
|
|
78
|
-
(e === !0 || e === "true") && (Y(!0),
|
|
79
|
+
const e = Ae || le.get("initArgument");
|
|
80
|
+
(e === !0 || e === "true") && (Y(!0), L(), We());
|
|
79
81
|
}
|
|
80
|
-
}, []),
|
|
81
|
-
Z && !
|
|
82
|
-
}, [Z]),
|
|
83
|
-
B?.id && !
|
|
82
|
+
}, []), M(() => {
|
|
83
|
+
Z && !s && (L(), ee(!1));
|
|
84
|
+
}, [Z]), M(() => {
|
|
85
|
+
B?.id && !s && (Be(B), ee(!0));
|
|
84
86
|
}, [B]);
|
|
85
|
-
const
|
|
86
|
-
de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content),
|
|
87
|
+
const Be = (e) => {
|
|
88
|
+
de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content), se(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? xe(e.rich_content) : te(e.content);
|
|
87
89
|
}, me = () => {
|
|
88
|
-
U(""), W(null), de({}),
|
|
89
|
-
},
|
|
90
|
+
U(""), W(null), de({}), se(null), q([]), ye((e) => e + 1), te(null);
|
|
91
|
+
}, Ee = (e) => {
|
|
90
92
|
b(e), ge(e);
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
93
|
+
}, $e = () => {
|
|
94
|
+
Pe(
|
|
95
|
+
/* @__PURE__ */ i(Oe, { fallback: null, children: /* @__PURE__ */ i(
|
|
96
|
+
mt,
|
|
95
97
|
{
|
|
96
98
|
modalTitle: r.formatMessage({
|
|
97
99
|
id: "modal.side_modal.modal_title",
|
|
98
100
|
defaultMessage: "Choose your side"
|
|
99
101
|
}),
|
|
100
|
-
onChooseSide:
|
|
102
|
+
onChooseSide: Ee,
|
|
101
103
|
positions: a,
|
|
102
104
|
title: _e,
|
|
103
|
-
disabledPositions: !
|
|
104
|
-
isNeutral:
|
|
105
|
+
disabledPositions: !s && T,
|
|
106
|
+
isNeutral: h && h.groupId == f && h.positionId === a[2]?.id
|
|
105
107
|
}
|
|
106
108
|
) })
|
|
107
109
|
);
|
|
108
|
-
},
|
|
109
|
-
S ?
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
},
|
|
110
|
+
}, Ve = () => {
|
|
111
|
+
S ? ie ? Ue() : !a || a?.length === 0 || !T?.find((e) => e?.id === l) && l || z && s ? ge(s && z && a[0]?.id) : $e() : (m && je({ groupId: f, parentId: m, ancestorIds: ve }), k({ loginAction: "argument" }));
|
|
112
|
+
}, qe = (e, t) => {
|
|
113
|
+
p ? k({ loginAction: "argument" }) : (U(e), W(t), $({ content: e }, [{ content: ["url", null] }]));
|
|
114
|
+
}, De = (e) => {
|
|
113
115
|
q(e);
|
|
114
116
|
}, fe = [
|
|
115
117
|
{ content: ["length", 3] },
|
|
@@ -120,20 +122,20 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
120
122
|
const t = e || l, c = {
|
|
121
123
|
content: D,
|
|
122
124
|
rich_content: ae,
|
|
123
|
-
group_id:
|
|
124
|
-
...
|
|
125
|
+
group_id: f,
|
|
126
|
+
...J && { group_type: J },
|
|
125
127
|
...t && { position_id: t },
|
|
126
|
-
is_reply: !!
|
|
127
|
-
message_id:
|
|
128
|
+
is_reply: !!m,
|
|
129
|
+
message_id: m || null,
|
|
128
130
|
source_ids: V?.map((o) => o.id)
|
|
129
131
|
};
|
|
130
132
|
$(c, fe) && (t && a && a.map((o) => o.id).includes(t) && Le({
|
|
131
|
-
groupId:
|
|
133
|
+
groupId: f,
|
|
132
134
|
positionId: t
|
|
133
135
|
}), me(), X.create("messages", c).then((o) => {
|
|
134
136
|
if (o.data.success) {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
+
if (m)
|
|
138
|
+
K(o.data.data.resource), j(
|
|
137
139
|
r.formatMessage({
|
|
138
140
|
id: "alert.argument_create",
|
|
139
141
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -147,12 +149,12 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
147
149
|
}
|
|
148
150
|
);
|
|
149
151
|
else {
|
|
150
|
-
const
|
|
152
|
+
const _ = o.data.data.resource;
|
|
151
153
|
let F = N;
|
|
152
|
-
t && !
|
|
154
|
+
t && !g && (F = `argumentList${_.position.id}`), K?.(
|
|
153
155
|
D,
|
|
154
|
-
a.find((
|
|
155
|
-
),
|
|
156
|
+
a.find((ke) => ke.id === t) || null
|
|
157
|
+
), y.add(F, [_]), j(
|
|
156
158
|
r.formatMessage({
|
|
157
159
|
id: "alert.argument_create",
|
|
158
160
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -177,32 +179,32 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
177
179
|
);
|
|
178
180
|
}
|
|
179
181
|
}));
|
|
180
|
-
},
|
|
182
|
+
}, Ue = () => {
|
|
181
183
|
const e = {
|
|
182
184
|
content: D,
|
|
183
185
|
rich_content: ae,
|
|
184
186
|
source_ids: V?.map((t) => t.id),
|
|
185
187
|
...l && { position_id: l }
|
|
186
188
|
};
|
|
187
|
-
$(e, fe) && X.update("messages",
|
|
189
|
+
$(e, fe) && X.update("messages", ie, e).then((t) => {
|
|
188
190
|
if (t.data.success) {
|
|
189
191
|
const c = t.data.data.resource;
|
|
190
192
|
let o = N;
|
|
191
|
-
if (A?.is_reply ||
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
} else l && !
|
|
195
|
-
if (!A?.is_reply && A?.position?.id != c.position?.id && !
|
|
196
|
-
const
|
|
197
|
-
|
|
193
|
+
if (A?.is_reply || s) {
|
|
194
|
+
const _ = A?.message_id || A?.reply_to_id || m;
|
|
195
|
+
_ && (o = `argument_${_}_reply_list`);
|
|
196
|
+
} else l && !g && (o = `argumentList${c.position?.id}`);
|
|
197
|
+
if (!A?.is_reply && A?.position?.id != c.position?.id && !g) {
|
|
198
|
+
const _ = `argumentList${A.position.id}`, F = `argumentList${c.position.id}`;
|
|
199
|
+
y.remove(_, [c]), y.add(F, [c]);
|
|
198
200
|
} else
|
|
199
|
-
|
|
201
|
+
y.update(o, [c]);
|
|
200
202
|
G && G(c), j(r.formatMessage({ id: "alert.argument_modify" }), {
|
|
201
203
|
type: "success"
|
|
202
204
|
}), me();
|
|
203
205
|
}
|
|
204
206
|
});
|
|
205
|
-
},
|
|
207
|
+
}, We = () => {
|
|
206
208
|
if (!oe) {
|
|
207
209
|
re(!0);
|
|
208
210
|
const e = setTimeout(() => {
|
|
@@ -211,8 +213,8 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
211
213
|
return () => clearTimeout(e);
|
|
212
214
|
}
|
|
213
215
|
}, O = () => {
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
+
p ? k({ loginAction: "argument" }) : ue(!0);
|
|
217
|
+
}, Ye = () => {
|
|
216
218
|
const e = T.find(
|
|
217
219
|
(t) => t.id === l
|
|
218
220
|
);
|
|
@@ -226,28 +228,28 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
226
228
|
);
|
|
227
229
|
};
|
|
228
230
|
return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
|
|
229
|
-
|
|
231
|
+
R && /* @__PURE__ */ i("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
|
|
230
232
|
id: "input.argument_input.user_banned",
|
|
231
233
|
defaultMessage: "You are banned from the debate space."
|
|
232
234
|
}) : r.formatMessage({
|
|
233
235
|
id: "info.debate_is_inactive",
|
|
234
236
|
defaultMessage: "Debate is closed"
|
|
235
237
|
}) }),
|
|
236
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ i(
|
|
237
239
|
"div",
|
|
238
240
|
{
|
|
239
|
-
className:
|
|
241
|
+
className: I(n.argumentInput, {
|
|
240
242
|
[n.flash]: oe,
|
|
241
|
-
[n.replyInputContainer]:
|
|
243
|
+
[n.replyInputContainer]: s
|
|
242
244
|
}),
|
|
243
|
-
children: /* @__PURE__ */
|
|
244
|
-
a.length > 0 && S && (!
|
|
245
|
-
/* @__PURE__ */
|
|
245
|
+
children: /* @__PURE__ */ i("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ C("div", { className: n.argumentInputBox, children: [
|
|
246
|
+
a.length > 0 && S && (!s || !z) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
|
|
247
|
+
/* @__PURE__ */ i("div", { children: r.formatMessage({
|
|
246
248
|
id: "input.position",
|
|
247
249
|
defaultMessage: "Your position"
|
|
248
250
|
}) }),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
|
|
251
|
+
/* @__PURE__ */ i(
|
|
252
|
+
rt,
|
|
251
253
|
{
|
|
252
254
|
activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
|
|
253
255
|
firstLabel: a[0],
|
|
@@ -259,27 +261,27 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
259
261
|
/* @__PURE__ */ C(
|
|
260
262
|
"div",
|
|
261
263
|
{
|
|
262
|
-
className:
|
|
263
|
-
[n.argumentTextInputBoxisTablet]: !
|
|
264
|
-
[n.replyEditorRow]:
|
|
264
|
+
className: I(n.argumentTextInputBox, {
|
|
265
|
+
[n.argumentTextInputBoxisTablet]: !g,
|
|
266
|
+
[n.replyEditorRow]: s
|
|
265
267
|
}),
|
|
266
268
|
children: [
|
|
267
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ i(
|
|
268
270
|
"div",
|
|
269
271
|
{
|
|
270
|
-
className:
|
|
271
|
-
[n.argumentAuthorContainerMobile]:
|
|
272
|
-
[n.argumentAuthorContainerActivated]: !
|
|
272
|
+
className: I(n.argumentAuthorContainer, {
|
|
273
|
+
[n.argumentAuthorContainerMobile]: g,
|
|
274
|
+
[n.argumentAuthorContainerActivated]: !g && x || s
|
|
273
275
|
}),
|
|
274
|
-
children: !
|
|
275
|
-
|
|
276
|
+
children: !g && x || s ? /* @__PURE__ */ i(
|
|
277
|
+
ut,
|
|
276
278
|
{
|
|
277
279
|
avatarUrl: d.image_url,
|
|
278
280
|
userName: d.full_name,
|
|
279
281
|
size: pe
|
|
280
282
|
}
|
|
281
|
-
) : /* @__PURE__ */
|
|
282
|
-
|
|
283
|
+
) : /* @__PURE__ */ i(
|
|
284
|
+
dt,
|
|
283
285
|
{
|
|
284
286
|
fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
|
|
285
287
|
avatarUrl: d?.image_url,
|
|
@@ -294,57 +296,57 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
294
296
|
{
|
|
295
297
|
onClick: O,
|
|
296
298
|
"data-testid": "argument-input",
|
|
297
|
-
className:
|
|
298
|
-
[n.replyTextEditorBox]:
|
|
299
|
+
className: I(n.textEditorBox, {
|
|
300
|
+
[n.replyTextEditorBox]: s
|
|
299
301
|
}),
|
|
300
302
|
children: [
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
|
|
303
|
+
/* @__PURE__ */ i(
|
|
304
|
+
lt,
|
|
303
305
|
{
|
|
304
306
|
handleChange: (e, t) => {
|
|
305
|
-
|
|
307
|
+
qe(e, t);
|
|
306
308
|
},
|
|
307
309
|
handleSourcesChange: (e) => {
|
|
308
|
-
|
|
310
|
+
De(e);
|
|
309
311
|
},
|
|
310
|
-
placeholder:
|
|
312
|
+
placeholder: be,
|
|
311
313
|
"aria-label": r.formatMessage({
|
|
312
314
|
id: "input.argument_input.aria_label",
|
|
313
315
|
defaultMessage: "Message input field"
|
|
314
316
|
}),
|
|
315
|
-
onSubmit:
|
|
317
|
+
onSubmit: Ve,
|
|
316
318
|
sources: V,
|
|
317
|
-
hideSourceAction: Me ||
|
|
318
|
-
uid:
|
|
319
|
+
hideSourceAction: Me || p,
|
|
320
|
+
uid: m ? `Reply${f}_${m}` : `Argument${f}`,
|
|
319
321
|
onActivation: O,
|
|
320
|
-
showStylesControls:
|
|
321
|
-
disabled:
|
|
322
|
-
maxLength:
|
|
323
|
-
disableRichText: v?.actions?.disableRichText ||
|
|
324
|
-
shortBar:
|
|
325
|
-
isReply:
|
|
326
|
-
resetSignal:
|
|
327
|
-
hideSubmit:
|
|
322
|
+
showStylesControls: x,
|
|
323
|
+
disabled: R || p || ce,
|
|
324
|
+
maxLength: p ? !1 : v?.actions?.argumentMaxLength,
|
|
325
|
+
disableRichText: v?.actions?.disableRichText || p,
|
|
326
|
+
shortBar: s,
|
|
327
|
+
isReply: s,
|
|
328
|
+
resetSignal: Te,
|
|
329
|
+
hideSubmit: p,
|
|
328
330
|
allowedDomains: v?.allowed_sources,
|
|
329
331
|
active: P,
|
|
330
|
-
autoFocus:
|
|
331
|
-
hideCharCount:
|
|
332
|
-
disableAutoActivate:
|
|
332
|
+
autoFocus: Ne,
|
|
333
|
+
hideCharCount: we,
|
|
334
|
+
disableAutoActivate: Se
|
|
333
335
|
}
|
|
334
336
|
),
|
|
335
|
-
E?.content && /* @__PURE__ */
|
|
336
|
-
|
|
337
|
+
E?.content && /* @__PURE__ */ i("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ i("div", { children: e }, t)) }),
|
|
338
|
+
x && T?.find(
|
|
337
339
|
(e) => e.id === l
|
|
338
340
|
) && /* @__PURE__ */ C(
|
|
339
341
|
"div",
|
|
340
342
|
{
|
|
341
|
-
className:
|
|
343
|
+
className: I(
|
|
342
344
|
n.argumentInputWarning,
|
|
343
345
|
n.disabledPositionWarning
|
|
344
346
|
),
|
|
345
347
|
children: [
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
|
|
348
|
+
/* @__PURE__ */ i(
|
|
349
|
+
ct,
|
|
348
350
|
{
|
|
349
351
|
name: "announcement",
|
|
350
352
|
className: n.warningIcon,
|
|
@@ -352,24 +354,24 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
352
354
|
width: 20
|
|
353
355
|
}
|
|
354
356
|
),
|
|
355
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ i("div", { className: n.argumentInputWarningText, children: Ye() })
|
|
356
358
|
]
|
|
357
359
|
}
|
|
358
360
|
),
|
|
359
|
-
|
|
361
|
+
x && H && !Ce && /* @__PURE__ */ i("div", { className: n.guideMessage, children: /* @__PURE__ */ i(
|
|
360
362
|
he,
|
|
361
363
|
{
|
|
362
364
|
id: "alert.guide_message",
|
|
363
365
|
defaultMessage: "Contributions must comply with our {userCharter}.",
|
|
364
366
|
values: {
|
|
365
|
-
userCharter: /* @__PURE__ */
|
|
367
|
+
userCharter: /* @__PURE__ */ i(
|
|
366
368
|
"a",
|
|
367
369
|
{
|
|
368
370
|
className: n.guideMessage,
|
|
369
371
|
href: H,
|
|
370
372
|
target: "_blank",
|
|
371
373
|
rel: "noreferrer",
|
|
372
|
-
children: /* @__PURE__ */
|
|
374
|
+
children: /* @__PURE__ */ i(
|
|
373
375
|
he,
|
|
374
376
|
{
|
|
375
377
|
id: "alert.user_charter",
|
|
@@ -393,5 +395,5 @@ const lt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
393
395
|
] });
|
|
394
396
|
};
|
|
395
397
|
export {
|
|
396
|
-
|
|
398
|
+
qt as ArgumentInput
|
|
397
399
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const t = "Logora:pendingReply", c = 18e5, a = ({ groupId: e, parentId: n, ancestorIds: r = [] }) => {
|
|
2
|
+
try {
|
|
3
|
+
sessionStorage.setItem(
|
|
4
|
+
t,
|
|
5
|
+
JSON.stringify({
|
|
6
|
+
groupId: e,
|
|
7
|
+
parentId: n,
|
|
8
|
+
ancestorIds: r,
|
|
9
|
+
createdAt: Date.now()
|
|
10
|
+
})
|
|
11
|
+
);
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
}, o = () => {
|
|
15
|
+
try {
|
|
16
|
+
sessionStorage.removeItem(t);
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}, i = () => {
|
|
20
|
+
try {
|
|
21
|
+
const e = JSON.parse(sessionStorage.getItem(t));
|
|
22
|
+
return !e || typeof e != "object" || !e.parentId ? null : Date.now() - (e.createdAt || 0) > 18e5 ? (o(), null) : e;
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
c as PENDING_REPLY_MAX_AGE,
|
|
29
|
+
o as clearPendingReply,
|
|
30
|
+
i as readPendingReply,
|
|
31
|
+
a as storePendingReply
|
|
32
|
+
};
|