@logora/debate 0.4.102 → 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.
- package/dist/components/argument/argument/Argument.js +192 -164
- package/dist/components/input/argument_input/ArgumentInput.js +151 -150
- package/dist/components/input/use_scroll_to_editor/useScrollToEditor.js +20 -0
- package/dist/components/util/pending_reply/pendingReply.js +32 -0
- package/dist/index.js +36 -34
- package/package.json +1 -1
|
@@ -1,117 +1,118 @@
|
|
|
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 {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
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 = ({
|
|
24
26
|
argumentListId: N,
|
|
25
27
|
avatarSize: pe = 48,
|
|
26
|
-
disabled:
|
|
28
|
+
disabled: R = !1,
|
|
27
29
|
positions: a = [],
|
|
28
30
|
disabledPositions: T = [],
|
|
29
|
-
groupId:
|
|
31
|
+
groupId: f,
|
|
30
32
|
groupName: _e,
|
|
31
|
-
groupType:
|
|
33
|
+
groupType: J,
|
|
32
34
|
hideSourceAction: Me = !1,
|
|
33
|
-
isReply:
|
|
34
|
-
onSubmit:
|
|
35
|
+
isReply: s = !1,
|
|
36
|
+
onSubmit: K,
|
|
35
37
|
onUpdate: G,
|
|
36
|
-
parentId:
|
|
37
|
-
|
|
38
|
+
parentId: m,
|
|
39
|
+
ancestorIds: ve = [],
|
|
40
|
+
placeholder: be,
|
|
38
41
|
positionId: w,
|
|
39
|
-
focusOnInit:
|
|
42
|
+
focusOnInit: Ae = !1,
|
|
40
43
|
activeOnInit: P = !1,
|
|
41
44
|
userGuideUrl: H,
|
|
42
|
-
hideUserGuideLink:
|
|
43
|
-
hideCharCount:
|
|
44
|
-
disableAutoActivate:
|
|
45
|
+
hideUserGuideLink: Ce = !1,
|
|
46
|
+
hideCharCount: we = !1,
|
|
47
|
+
disableAutoActivate: Se = !1,
|
|
45
48
|
autoFocus: Q = !1
|
|
46
49
|
}) => {
|
|
47
|
-
const r =
|
|
50
|
+
const r = Je(), X = Ge(), y = He(), v = Qe(), {
|
|
48
51
|
focus: Z,
|
|
49
52
|
setFocus: ee,
|
|
50
53
|
inputContent: B,
|
|
51
54
|
setInputContent: te,
|
|
52
|
-
setInputRichContent:
|
|
53
|
-
} =
|
|
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(
|
|
54
57
|
"userSide",
|
|
55
58
|
{}
|
|
56
|
-
), [
|
|
59
|
+
), [p, Fe] = u(
|
|
57
60
|
!S && v?.actions?.disableInputForVisitor
|
|
58
|
-
),
|
|
61
|
+
), k = it(), { showModal: Pe } = st(), { toast: j } = ot() || {}, le = new URLSearchParams(
|
|
59
62
|
typeof window < "u" ? window.location.search : Ie.search
|
|
60
63
|
);
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
M(() => {
|
|
65
|
+
Fe(
|
|
63
66
|
!S && v?.actions?.disableInputForVisitor
|
|
64
67
|
);
|
|
65
68
|
}, [S, v]);
|
|
66
69
|
const z = d?.role === "editor" || d?.role === "moderator", ce = d?.moderation_status === "banned";
|
|
67
|
-
|
|
70
|
+
M(() => {
|
|
68
71
|
let e = null;
|
|
69
|
-
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) :
|
|
70
|
-
}, [w]),
|
|
71
|
-
Q &&
|
|
72
|
-
}, [Q]),
|
|
73
|
-
P && (O(),
|
|
74
|
-
}, [P]),
|
|
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(() => {
|
|
74
|
+
Q && Y(!0);
|
|
75
|
+
}, [Q]), M(() => {
|
|
76
|
+
P && (O(), Y(!0), L());
|
|
77
|
+
}, [P]), M(() => {
|
|
75
78
|
if (typeof window < "u") {
|
|
76
|
-
const e =
|
|
77
|
-
(e === !0 || e === "true") && (
|
|
79
|
+
const e = Ae || le.get("initArgument");
|
|
80
|
+
(e === !0 || e === "true") && (Y(!0), L(), We());
|
|
78
81
|
}
|
|
79
|
-
}, []),
|
|
80
|
-
Z && !
|
|
81
|
-
}, [Z]),
|
|
82
|
-
B?.id && !
|
|
82
|
+
}, []), M(() => {
|
|
83
|
+
Z && !s && (L(), ee(!1));
|
|
84
|
+
}, [Z]), M(() => {
|
|
85
|
+
B?.id && !s && (Be(B), ee(!0));
|
|
83
86
|
}, [B]);
|
|
84
|
-
const
|
|
85
|
-
de(e), ue(!0),
|
|
86
|
-
}, y = () => {
|
|
87
|
-
ne.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
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);
|
|
88
89
|
}, me = () => {
|
|
89
|
-
|
|
90
|
-
},
|
|
90
|
+
U(""), W(null), de({}), se(null), q([]), ye((e) => e + 1), te(null);
|
|
91
|
+
}, Ee = (e) => {
|
|
91
92
|
b(e), ge(e);
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
93
|
+
}, $e = () => {
|
|
94
|
+
Pe(
|
|
95
|
+
/* @__PURE__ */ i(Oe, { fallback: null, children: /* @__PURE__ */ i(
|
|
96
|
+
mt,
|
|
96
97
|
{
|
|
97
98
|
modalTitle: r.formatMessage({
|
|
98
99
|
id: "modal.side_modal.modal_title",
|
|
99
100
|
defaultMessage: "Choose your side"
|
|
100
101
|
}),
|
|
101
|
-
onChooseSide:
|
|
102
|
+
onChooseSide: Ee,
|
|
102
103
|
positions: a,
|
|
103
104
|
title: _e,
|
|
104
|
-
disabledPositions: !
|
|
105
|
-
isNeutral:
|
|
105
|
+
disabledPositions: !s && T,
|
|
106
|
+
isNeutral: h && h.groupId == f && h.positionId === a[2]?.id
|
|
106
107
|
}
|
|
107
108
|
) })
|
|
108
109
|
);
|
|
109
|
-
},
|
|
110
|
-
S ?
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
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) => {
|
|
115
|
+
q(e);
|
|
115
116
|
}, fe = [
|
|
116
117
|
{ content: ["length", 3] },
|
|
117
118
|
{ content: ["required", null] },
|
|
@@ -119,22 +120,22 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
119
120
|
...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
|
|
120
121
|
], ge = (e) => {
|
|
121
122
|
const t = e || l, c = {
|
|
122
|
-
content:
|
|
123
|
+
content: D,
|
|
123
124
|
rich_content: ae,
|
|
124
|
-
group_id:
|
|
125
|
-
...
|
|
125
|
+
group_id: f,
|
|
126
|
+
...J && { group_type: J },
|
|
126
127
|
...t && { position_id: t },
|
|
127
|
-
is_reply: !!
|
|
128
|
-
message_id:
|
|
128
|
+
is_reply: !!m,
|
|
129
|
+
message_id: m || null,
|
|
129
130
|
source_ids: V?.map((o) => o.id)
|
|
130
131
|
};
|
|
131
132
|
$(c, fe) && (t && a && a.map((o) => o.id).includes(t) && Le({
|
|
132
|
-
groupId:
|
|
133
|
+
groupId: f,
|
|
133
134
|
positionId: t
|
|
134
135
|
}), me(), X.create("messages", c).then((o) => {
|
|
135
136
|
if (o.data.success) {
|
|
136
|
-
if (
|
|
137
|
-
|
|
137
|
+
if (m)
|
|
138
|
+
K(o.data.data.resource), j(
|
|
138
139
|
r.formatMessage({
|
|
139
140
|
id: "alert.argument_create",
|
|
140
141
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -148,12 +149,12 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
148
149
|
}
|
|
149
150
|
);
|
|
150
151
|
else {
|
|
151
|
-
const
|
|
152
|
+
const _ = o.data.data.resource;
|
|
152
153
|
let F = N;
|
|
153
|
-
t && !
|
|
154
|
-
|
|
155
|
-
a.find((
|
|
156
|
-
),
|
|
154
|
+
t && !g && (F = `argumentList${_.position.id}`), K?.(
|
|
155
|
+
D,
|
|
156
|
+
a.find((ke) => ke.id === t) || null
|
|
157
|
+
), y.add(F, [_]), j(
|
|
157
158
|
r.formatMessage({
|
|
158
159
|
id: "alert.argument_create",
|
|
159
160
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -178,32 +179,32 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
178
179
|
);
|
|
179
180
|
}
|
|
180
181
|
}));
|
|
181
|
-
},
|
|
182
|
+
}, Ue = () => {
|
|
182
183
|
const e = {
|
|
183
|
-
content:
|
|
184
|
+
content: D,
|
|
184
185
|
rich_content: ae,
|
|
185
186
|
source_ids: V?.map((t) => t.id),
|
|
186
187
|
...l && { position_id: l }
|
|
187
188
|
};
|
|
188
|
-
$(e, fe) && X.update("messages",
|
|
189
|
+
$(e, fe) && X.update("messages", ie, e).then((t) => {
|
|
189
190
|
if (t.data.success) {
|
|
190
191
|
const c = t.data.data.resource;
|
|
191
192
|
let o = N;
|
|
192
|
-
if (A?.is_reply ||
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
} else l && !
|
|
196
|
-
if (!A?.is_reply && A?.position?.id != c.position?.id && !
|
|
197
|
-
const
|
|
198
|
-
|
|
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]);
|
|
199
200
|
} else
|
|
200
|
-
|
|
201
|
+
y.update(o, [c]);
|
|
201
202
|
G && G(c), j(r.formatMessage({ id: "alert.argument_modify" }), {
|
|
202
203
|
type: "success"
|
|
203
204
|
}), me();
|
|
204
205
|
}
|
|
205
206
|
});
|
|
206
|
-
},
|
|
207
|
+
}, We = () => {
|
|
207
208
|
if (!oe) {
|
|
208
209
|
re(!0);
|
|
209
210
|
const e = setTimeout(() => {
|
|
@@ -212,8 +213,8 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
212
213
|
return () => clearTimeout(e);
|
|
213
214
|
}
|
|
214
215
|
}, O = () => {
|
|
215
|
-
|
|
216
|
-
},
|
|
216
|
+
p ? k({ loginAction: "argument" }) : ue(!0);
|
|
217
|
+
}, Ye = () => {
|
|
217
218
|
const e = T.find(
|
|
218
219
|
(t) => t.id === l
|
|
219
220
|
);
|
|
@@ -227,28 +228,28 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
227
228
|
);
|
|
228
229
|
};
|
|
229
230
|
return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
|
|
230
|
-
|
|
231
|
+
R && /* @__PURE__ */ i("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
|
|
231
232
|
id: "input.argument_input.user_banned",
|
|
232
233
|
defaultMessage: "You are banned from the debate space."
|
|
233
234
|
}) : r.formatMessage({
|
|
234
235
|
id: "info.debate_is_inactive",
|
|
235
236
|
defaultMessage: "Debate is closed"
|
|
236
237
|
}) }),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ i(
|
|
238
239
|
"div",
|
|
239
240
|
{
|
|
240
|
-
className:
|
|
241
|
+
className: I(n.argumentInput, {
|
|
241
242
|
[n.flash]: oe,
|
|
242
|
-
[n.replyInputContainer]:
|
|
243
|
+
[n.replyInputContainer]: s
|
|
243
244
|
}),
|
|
244
|
-
children: /* @__PURE__ */
|
|
245
|
-
a.length > 0 && S && (!
|
|
246
|
-
/* @__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({
|
|
247
248
|
id: "input.position",
|
|
248
249
|
defaultMessage: "Your position"
|
|
249
250
|
}) }),
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
|
|
251
|
+
/* @__PURE__ */ i(
|
|
252
|
+
rt,
|
|
252
253
|
{
|
|
253
254
|
activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
|
|
254
255
|
firstLabel: a[0],
|
|
@@ -260,27 +261,27 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
260
261
|
/* @__PURE__ */ C(
|
|
261
262
|
"div",
|
|
262
263
|
{
|
|
263
|
-
className:
|
|
264
|
-
[n.argumentTextInputBoxisTablet]: !
|
|
265
|
-
[n.replyEditorRow]:
|
|
264
|
+
className: I(n.argumentTextInputBox, {
|
|
265
|
+
[n.argumentTextInputBoxisTablet]: !g,
|
|
266
|
+
[n.replyEditorRow]: s
|
|
266
267
|
}),
|
|
267
268
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ i(
|
|
269
270
|
"div",
|
|
270
271
|
{
|
|
271
|
-
className:
|
|
272
|
-
[n.argumentAuthorContainerMobile]:
|
|
273
|
-
[n.argumentAuthorContainerActivated]: !
|
|
272
|
+
className: I(n.argumentAuthorContainer, {
|
|
273
|
+
[n.argumentAuthorContainerMobile]: g,
|
|
274
|
+
[n.argumentAuthorContainerActivated]: !g && x || s
|
|
274
275
|
}),
|
|
275
|
-
children: !
|
|
276
|
-
|
|
276
|
+
children: !g && x || s ? /* @__PURE__ */ i(
|
|
277
|
+
ut,
|
|
277
278
|
{
|
|
278
279
|
avatarUrl: d.image_url,
|
|
279
280
|
userName: d.full_name,
|
|
280
281
|
size: pe
|
|
281
282
|
}
|
|
282
|
-
) : /* @__PURE__ */
|
|
283
|
-
|
|
283
|
+
) : /* @__PURE__ */ i(
|
|
284
|
+
dt,
|
|
284
285
|
{
|
|
285
286
|
fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
|
|
286
287
|
avatarUrl: d?.image_url,
|
|
@@ -295,57 +296,57 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
295
296
|
{
|
|
296
297
|
onClick: O,
|
|
297
298
|
"data-testid": "argument-input",
|
|
298
|
-
className:
|
|
299
|
-
[n.replyTextEditorBox]:
|
|
299
|
+
className: I(n.textEditorBox, {
|
|
300
|
+
[n.replyTextEditorBox]: s
|
|
300
301
|
}),
|
|
301
302
|
children: [
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
-
|
|
303
|
+
/* @__PURE__ */ i(
|
|
304
|
+
lt,
|
|
304
305
|
{
|
|
305
306
|
handleChange: (e, t) => {
|
|
306
|
-
|
|
307
|
+
qe(e, t);
|
|
307
308
|
},
|
|
308
309
|
handleSourcesChange: (e) => {
|
|
309
|
-
|
|
310
|
+
De(e);
|
|
310
311
|
},
|
|
311
|
-
placeholder:
|
|
312
|
+
placeholder: be,
|
|
312
313
|
"aria-label": r.formatMessage({
|
|
313
314
|
id: "input.argument_input.aria_label",
|
|
314
315
|
defaultMessage: "Message input field"
|
|
315
316
|
}),
|
|
316
|
-
onSubmit:
|
|
317
|
+
onSubmit: Ve,
|
|
317
318
|
sources: V,
|
|
318
|
-
hideSourceAction: Me ||
|
|
319
|
-
uid:
|
|
319
|
+
hideSourceAction: Me || p,
|
|
320
|
+
uid: m ? `Reply${f}_${m}` : `Argument${f}`,
|
|
320
321
|
onActivation: O,
|
|
321
|
-
showStylesControls:
|
|
322
|
-
disabled:
|
|
323
|
-
maxLength:
|
|
324
|
-
disableRichText: v?.actions?.disableRichText ||
|
|
325
|
-
shortBar:
|
|
326
|
-
isReply:
|
|
327
|
-
resetSignal:
|
|
328
|
-
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,
|
|
329
330
|
allowedDomains: v?.allowed_sources,
|
|
330
331
|
active: P,
|
|
331
|
-
autoFocus:
|
|
332
|
-
hideCharCount:
|
|
333
|
-
disableAutoActivate:
|
|
332
|
+
autoFocus: Ne,
|
|
333
|
+
hideCharCount: we,
|
|
334
|
+
disableAutoActivate: Se
|
|
334
335
|
}
|
|
335
336
|
),
|
|
336
|
-
E?.content && /* @__PURE__ */
|
|
337
|
-
|
|
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(
|
|
338
339
|
(e) => e.id === l
|
|
339
340
|
) && /* @__PURE__ */ C(
|
|
340
341
|
"div",
|
|
341
342
|
{
|
|
342
|
-
className:
|
|
343
|
+
className: I(
|
|
343
344
|
n.argumentInputWarning,
|
|
344
345
|
n.disabledPositionWarning
|
|
345
346
|
),
|
|
346
347
|
children: [
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
|
|
348
|
+
/* @__PURE__ */ i(
|
|
349
|
+
ct,
|
|
349
350
|
{
|
|
350
351
|
name: "announcement",
|
|
351
352
|
className: n.warningIcon,
|
|
@@ -353,24 +354,24 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
353
354
|
width: 20
|
|
354
355
|
}
|
|
355
356
|
),
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ i("div", { className: n.argumentInputWarningText, children: Ye() })
|
|
357
358
|
]
|
|
358
359
|
}
|
|
359
360
|
),
|
|
360
|
-
|
|
361
|
+
x && H && !Ce && /* @__PURE__ */ i("div", { className: n.guideMessage, children: /* @__PURE__ */ i(
|
|
361
362
|
he,
|
|
362
363
|
{
|
|
363
364
|
id: "alert.guide_message",
|
|
364
365
|
defaultMessage: "Contributions must comply with our {userCharter}.",
|
|
365
366
|
values: {
|
|
366
|
-
userCharter: /* @__PURE__ */
|
|
367
|
+
userCharter: /* @__PURE__ */ i(
|
|
367
368
|
"a",
|
|
368
369
|
{
|
|
369
370
|
className: n.guideMessage,
|
|
370
371
|
href: H,
|
|
371
372
|
target: "_blank",
|
|
372
373
|
rel: "noreferrer",
|
|
373
|
-
children: /* @__PURE__ */
|
|
374
|
+
children: /* @__PURE__ */ i(
|
|
374
375
|
he,
|
|
375
376
|
{
|
|
376
377
|
id: "alert.user_charter",
|
|
@@ -394,5 +395,5 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
394
395
|
] });
|
|
395
396
|
};
|
|
396
397
|
export {
|
|
397
|
-
|
|
398
|
+
qt as ArgumentInput
|
|
398
399
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useRef as t, useCallback as c, useEffect as i } from "react";
|
|
2
|
+
const u = (e) => {
|
|
3
|
+
const r = t(null), o = c(() => {
|
|
4
|
+
window.cancelAnimationFrame(r.current), r.current = window.requestAnimationFrame(() => {
|
|
5
|
+
r.current = window.requestAnimationFrame(() => {
|
|
6
|
+
const n = e?.current;
|
|
7
|
+
n && n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
}, [e]);
|
|
11
|
+
return i(
|
|
12
|
+
() => () => {
|
|
13
|
+
window.cancelAnimationFrame(r.current);
|
|
14
|
+
},
|
|
15
|
+
[]
|
|
16
|
+
), o;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
u as useScrollToEditor
|
|
20
|
+
};
|
|
@@ -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
|
+
};
|