@logora/debate 0.3.79 → 0.3.81
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 +6 -6
- package/dist/components/icons/spiegel_icons/Downvote.js +2 -2
- package/dist/components/icons/spiegel_icons/Upvote.js +2 -2
- package/dist/components/input/argument_input/ArgumentInput.js +140 -137
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.js +70 -72
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import { VoteButton as Ce } from "../../vote/vote_button/VoteButton.js";
|
|
|
20
20
|
import { VotePaginatedList as Se } from "../../list/paginated_list/VotePaginatedList.js";
|
|
21
21
|
import { UserContentSkeleton as Re } from "../../skeleton/user_content_skeleton/UserContentSkeleton.js";
|
|
22
22
|
import { Button as Te } from "../../action/button/Button.js";
|
|
23
|
-
const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))),
|
|
23
|
+
const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), F = (e) => e?.replace(/ /g, " "), we = ({
|
|
24
24
|
argument: e,
|
|
25
25
|
argumentReplies: n,
|
|
26
26
|
nestingLevel: y = 0,
|
|
@@ -28,7 +28,7 @@ const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
28
28
|
groupType: C,
|
|
29
29
|
groupName: S,
|
|
30
30
|
positions: _ = [],
|
|
31
|
-
disableLinks:
|
|
31
|
+
disableLinks: P = !1,
|
|
32
32
|
parentArgument: d,
|
|
33
33
|
flashParent: j,
|
|
34
34
|
expandable: G,
|
|
@@ -125,7 +125,7 @@ const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
125
125
|
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : oe.translatedContent,
|
|
126
126
|
date: e.created_at,
|
|
127
127
|
tagClassName: s[`headerPosition-${v}`],
|
|
128
|
-
disableLinks:
|
|
128
|
+
disableLinks: P,
|
|
129
129
|
isDeleted: e.is_deleted,
|
|
130
130
|
showModerationFeedback: q ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
|
|
131
131
|
moderationReason: e.moderation_entry?.moderation_reason,
|
|
@@ -179,9 +179,9 @@ const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
179
179
|
"div",
|
|
180
180
|
{
|
|
181
181
|
className: s.argumentContent,
|
|
182
|
-
dangerouslySetInnerHTML: { __html:
|
|
182
|
+
dangerouslySetInnerHTML: { __html: F(A) }
|
|
183
183
|
}
|
|
184
|
-
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children:
|
|
184
|
+
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: F(u.translatedContent) }),
|
|
185
185
|
u.isTranslated && /* @__PURE__ */ o(
|
|
186
186
|
ve,
|
|
187
187
|
{
|
|
@@ -279,7 +279,7 @@ const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
279
279
|
X.add(a, [t]), L(), b(!0);
|
|
280
280
|
},
|
|
281
281
|
isReply: !0,
|
|
282
|
-
|
|
282
|
+
autoFocus: !0,
|
|
283
283
|
avatarSize: 40,
|
|
284
284
|
placeholder: i.formatMessage({
|
|
285
285
|
id: "input.reply_input.your_answer",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as L } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
const
|
|
3
|
+
const H = (C) => /* @__PURE__ */ L("svg", { viewBox: "0 0 50 50", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...C, children: /* @__PURE__ */ L("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M25.1109 48.0906C29.3616 48.0903 32.8082 44.644 32.8082 40.3933V32.697H41.2457C44.8599 32.6967 47.5856 29.4125 46.9195 25.8601L43.3121 6.61792L43.2584 6.36401C42.6504 3.76613 40.329 1.9092 37.6383 1.90894H25.0035L24.5572 1.92261C23.6651 1.97446 22.7885 2.18144 21.9674 2.53394L21.5621 2.72241L16.3023 5.35132C15.835 5.58497 15.3253 5.72136 14.8053 5.75171L14.5816 5.75757H9.71738L2.01953 5.7578V28.8484L9.71738 28.8484H15.4898L19.0963 34.2576C19.2556 34.4966 19.3594 34.7691 19.4 35.0535L21.0269 46.4382C21.1624 47.3861 21.9738 48.0904 22.9312 48.0906H25.1109ZM21.5924 32.5935C22.0001 33.2052 22.2657 33.9009 22.3697 34.6287L23.8648 45.0906H25.1109C27.7047 45.0903 29.8082 42.9872 29.8082 40.3933V29.697H41.2457C42.9815 29.6967 44.2911 28.119 43.9713 26.4128L40.3629 7.17065C40.1169 5.85969 38.9721 4.90921 37.6383 4.90894H25.0035C24.2746 4.90899 23.5549 5.07912 22.9029 5.40503L17.6441 8.03491C16.6934 8.51025 15.6446 8.75748 14.5816 8.75757H12.7174V25.8484H17.0953L21.5924 32.5935Z" }) });
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
H as Downvote
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as L } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
const
|
|
3
|
+
const H = (C) => /* @__PURE__ */ L("svg", { viewBox: "0 0 50 50", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...C, children: /* @__PURE__ */ L("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M32.8082 9.60669C32.8082 5.35599 29.3616 1.90969 25.1109 1.90942H22.9312C21.9738 1.90957 21.1624 2.61392 21.0269 3.56177L19.4 14.9465C19.3594 15.2309 19.2556 15.5034 19.0963 15.7424L15.4898 21.1516H9.7164L2.01953 21.1516V44.2422L9.7164 44.2424H14.5816L14.8053 44.2483C15.3253 44.2786 15.835 44.415 16.3023 44.6487L21.5621 47.2776L21.9674 47.4661C22.7885 47.8186 23.6651 48.0255 24.5572 48.0774L25.0035 48.0911H37.6383C40.329 48.0908 42.6504 46.2339 43.2584 43.636L43.3121 43.3821L46.9195 24.1399C47.5856 20.5875 44.8599 17.3033 41.2457 17.303H32.8082V9.60669ZM21.5924 17.4065C22.0001 16.7948 22.2657 16.0991 22.3697 15.3713L23.8648 4.90942H25.1109C27.7047 4.90969 29.8082 7.01284 29.8082 9.60669V20.303H41.2457C42.9815 20.3033 44.2911 21.881 43.9713 23.5872L40.3629 42.8293C40.1169 44.1403 38.9721 45.0908 37.6383 45.0911H25.0035C24.2746 45.091 23.5549 44.9209 22.9029 44.595L17.6441 41.9651C16.6934 41.4897 15.6446 41.2425 14.5816 41.2424H12.7164V24.1516H17.0953L21.5924 17.4065Z" }) });
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
H as Upvote
|
|
6
6
|
};
|
|
@@ -1,137 +1,140 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useLocation as
|
|
1
|
+
import { jsxs as v, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import We from "@rooks/use-sessionstorage-state";
|
|
3
|
+
import { useRef as Ye, useState as l, useEffect as h, Suspense as ke, lazy as Re } from "react";
|
|
4
|
+
import { useIntl as je, FormattedMessage as ge } from "react-intl";
|
|
5
|
+
import { useLocation as ze } from "react-router";
|
|
6
6
|
import I from "classnames";
|
|
7
7
|
import n from "./ArgumentInput.module.scss.js";
|
|
8
|
-
import { useDataProvider as
|
|
9
|
-
import { useList as
|
|
10
|
-
import { useConfig as
|
|
11
|
-
import { useInput as
|
|
12
|
-
import { useAuth as
|
|
13
|
-
import { useFormValidation as
|
|
14
|
-
import { useResponsive as
|
|
15
|
-
import { useAuthRequired as
|
|
16
|
-
import { useModal as
|
|
17
|
-
import { useToast as
|
|
18
|
-
import { TogglePosition as
|
|
19
|
-
import { Avatar as
|
|
20
|
-
import { AuthorBox as
|
|
21
|
-
import { TextEditor as
|
|
22
|
-
import { Icon as
|
|
23
|
-
const
|
|
8
|
+
import { useDataProvider as Oe } from "../../data/data_provider/useDataProvider.js";
|
|
9
|
+
import { useList as Je } from "../../list/list_provider/useList.js";
|
|
10
|
+
import { useConfig as Ke } from "../../data/config_provider/useConfig.js";
|
|
11
|
+
import { useInput as Ge } from "../input_provider/useInput.js";
|
|
12
|
+
import { useAuth as He } from "../../auth/use_auth/useAuth.js";
|
|
13
|
+
import { useFormValidation as Qe } from "../../forms/use_form_validation/useFormValidation.js";
|
|
14
|
+
import { useResponsive as Xe } from "../../hooks/use_responsive/useResponsive.js";
|
|
15
|
+
import { useAuthRequired as Ze } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
16
|
+
import { useModal as et } from "../../dialog/modal/useModal.js";
|
|
17
|
+
import { useToast as tt } from "../../dialog/toast_provider/useToast.js";
|
|
18
|
+
import { TogglePosition as nt } from "../toggle_position/TogglePosition.js";
|
|
19
|
+
import { Avatar as at } from "../../user/avatar/Avatar.js";
|
|
20
|
+
import { AuthorBox as st } from "../../user/author_box/AuthorBox.js";
|
|
21
|
+
import { TextEditor as it } from "../text_editor/TextEditor.js";
|
|
22
|
+
import { Icon as ot } from "../../icons/icon/Icon.js";
|
|
23
|
+
const rt = Re(() => import("../../modal/side_modal/index.js").then((S) => ({ default: S.SideModal }))), Lt = ({
|
|
24
24
|
argumentListId: S,
|
|
25
|
-
avatarSize:
|
|
26
|
-
disabled:
|
|
25
|
+
avatarSize: he = 48,
|
|
26
|
+
disabled: O = !1,
|
|
27
27
|
positions: a = [],
|
|
28
28
|
disabledPositions: x = [],
|
|
29
29
|
groupId: b,
|
|
30
|
-
groupName:
|
|
31
|
-
groupType:
|
|
32
|
-
hideSourceAction:
|
|
30
|
+
groupName: pe,
|
|
31
|
+
groupType: J,
|
|
32
|
+
hideSourceAction: _e = !1,
|
|
33
33
|
isReply: r = !1,
|
|
34
|
-
onSubmit:
|
|
34
|
+
onSubmit: K,
|
|
35
35
|
parentId: F,
|
|
36
|
-
placeholder:
|
|
36
|
+
placeholder: Me,
|
|
37
37
|
positionId: A,
|
|
38
|
-
focusOnInit:
|
|
38
|
+
focusOnInit: ve = !1,
|
|
39
39
|
activeOnInit: P = !1,
|
|
40
|
-
userGuideUrl:
|
|
41
|
-
hideUserGuideLink:
|
|
42
|
-
hideCharCount:
|
|
43
|
-
disableAutoActivate:
|
|
40
|
+
userGuideUrl: G,
|
|
41
|
+
hideUserGuideLink: be = !1,
|
|
42
|
+
hideCharCount: Ae = !1,
|
|
43
|
+
disableAutoActivate: Ce = !1,
|
|
44
|
+
autoFocus: H = !1
|
|
44
45
|
}) => {
|
|
45
|
-
const o =
|
|
46
|
-
focus:
|
|
47
|
-
setFocus:
|
|
48
|
-
setReset:
|
|
46
|
+
const o = je(), Q = Oe(), N = Je(), p = Ke(), {
|
|
47
|
+
focus: X,
|
|
48
|
+
setFocus: Z,
|
|
49
|
+
setReset: we,
|
|
49
50
|
inputContent: B,
|
|
50
|
-
setInputContent:
|
|
51
|
-
setInputRichContent:
|
|
52
|
-
} =
|
|
51
|
+
setInputContent: ee,
|
|
52
|
+
setInputRichContent: Ie
|
|
53
|
+
} = Ge(), { isLoggedIn: C, currentUser: u } = He(), { errors: E, validate: V } = Qe(), { isMobile: m } = Xe(), Se = ze(), te = Ye(null), [U, $] = l([]), [q, D] = l(""), [ne, W] = l(null), [d, _] = l(null), [ae, se] = l(null), [ie, oe] = l(!1), [w, re] = l(!1), [M, ue] = l({}), [xe, Y] = l(!1), [f, Ne] = We(
|
|
53
54
|
"userSide",
|
|
54
55
|
{}
|
|
55
|
-
), [g,
|
|
56
|
-
!C &&
|
|
57
|
-
),
|
|
58
|
-
typeof window < "u" ? window.location.search :
|
|
56
|
+
), [g, Te] = l(
|
|
57
|
+
!C && p?.actions?.disableInputForVisitor
|
|
58
|
+
), k = Ze(), { showModal: ye } = et(), { toast: R } = tt() || {}, de = new URLSearchParams(
|
|
59
|
+
typeof window < "u" ? window.location.search : Se.search
|
|
59
60
|
);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
!C &&
|
|
61
|
+
h(() => {
|
|
62
|
+
Te(
|
|
63
|
+
!C && p?.actions?.disableInputForVisitor
|
|
63
64
|
);
|
|
64
|
-
}, [C,
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
}, [C, p]);
|
|
66
|
+
const j = u?.role === "editor" || u?.role === "moderator", le = u?.moderation_status === "banned";
|
|
67
|
+
h(() => {
|
|
67
68
|
let e = null;
|
|
68
|
-
typeof window < "u" && (e =
|
|
69
|
-
}, [A]),
|
|
70
|
-
|
|
71
|
-
}, [
|
|
69
|
+
typeof window < "u" && (e = de.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? _(A) : e && e != a[2]?.id ? _(e) : f && f.groupId == b && f.positionId != a[2]?.id && _(f.positionId);
|
|
70
|
+
}, [A]), h(() => {
|
|
71
|
+
H && Y(!0);
|
|
72
|
+
}, [H]), h(() => {
|
|
73
|
+
P && (z(), Y(!0), T());
|
|
74
|
+
}, [P]), h(() => {
|
|
72
75
|
if (typeof window < "u") {
|
|
73
|
-
const e =
|
|
74
|
-
(e === !0 || e === "true") && (
|
|
76
|
+
const e = ve || de.get("initArgument");
|
|
77
|
+
(e === !0 || e === "true") && (Y(!0), T(), $e());
|
|
75
78
|
}
|
|
76
|
-
}, []),
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
B?.id && (
|
|
79
|
+
}, []), h(() => {
|
|
80
|
+
X && (T(), Z(!1));
|
|
81
|
+
}, [X]), h(() => {
|
|
82
|
+
B?.id && (Le(B), Z(!0));
|
|
80
83
|
}, [B]);
|
|
81
|
-
const
|
|
82
|
-
|
|
84
|
+
const Le = (e) => {
|
|
85
|
+
ue(e), re(!0), $(e.sources), D(e.content), W(e.rich_content), se(e.id), T(), _(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : ee(e.content);
|
|
83
86
|
}, T = () => {
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
D(""), W(null),
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */ s(
|
|
92
|
-
|
|
87
|
+
te.current.scrollIntoView(!1);
|
|
88
|
+
}, ce = () => {
|
|
89
|
+
D(""), W(null), ue({}), se(null), $([]), we(!0), ee(null);
|
|
90
|
+
}, Fe = (e) => {
|
|
91
|
+
_(e), fe(e);
|
|
92
|
+
}, Pe = () => {
|
|
93
|
+
ye(
|
|
94
|
+
/* @__PURE__ */ s(ke, { fallback: null, children: /* @__PURE__ */ s(
|
|
95
|
+
rt,
|
|
93
96
|
{
|
|
94
97
|
modalTitle: o.formatMessage({
|
|
95
98
|
id: "modal.side_modal.modal_title",
|
|
96
99
|
defaultMessage: "Choose your side"
|
|
97
100
|
}),
|
|
98
|
-
onChooseSide:
|
|
101
|
+
onChooseSide: Fe,
|
|
99
102
|
positions: a,
|
|
100
|
-
title:
|
|
103
|
+
title: pe,
|
|
101
104
|
disabledPositions: !r && x,
|
|
102
105
|
isNeutral: f && f.groupId == b && f.positionId === a[2]?.id
|
|
103
106
|
}
|
|
104
107
|
) })
|
|
105
108
|
);
|
|
106
|
-
},
|
|
107
|
-
C ?
|
|
108
|
-
},
|
|
109
|
-
g ?
|
|
110
|
-
},
|
|
109
|
+
}, Be = () => {
|
|
110
|
+
C ? ae ? Ue() : !a || a?.length === 0 || !x?.find((e) => e?.id === d) && d || j && r ? fe(r && j && a[0]?.id) : Pe() : k({ loginAction: "argument" });
|
|
111
|
+
}, Ee = (e, t) => {
|
|
112
|
+
g ? k({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
|
|
113
|
+
}, Ve = (e) => {
|
|
111
114
|
$(e);
|
|
112
|
-
},
|
|
115
|
+
}, me = [
|
|
113
116
|
{ content: ["length", 3] },
|
|
114
117
|
{ content: ["required", null] },
|
|
115
118
|
{ content: ["url", null] },
|
|
116
119
|
...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
|
|
117
|
-
],
|
|
120
|
+
], fe = (e) => {
|
|
118
121
|
const t = e || d, c = {
|
|
119
122
|
content: q,
|
|
120
|
-
rich_content:
|
|
123
|
+
rich_content: ne,
|
|
121
124
|
group_id: b,
|
|
122
|
-
...
|
|
125
|
+
...J && { group_type: J },
|
|
123
126
|
...t && { position_id: t },
|
|
124
127
|
is_reply: !!F,
|
|
125
128
|
message_id: F || null,
|
|
126
129
|
source_ids: U?.map((i) => i.id)
|
|
127
130
|
};
|
|
128
|
-
V(c,
|
|
131
|
+
V(c, me) && (t && a && a.map((i) => i.id).includes(t) && Ne({
|
|
129
132
|
groupId: b,
|
|
130
133
|
positionId: t
|
|
131
|
-
}),
|
|
134
|
+
}), ce(), Q.create("messages", c).then((i) => {
|
|
132
135
|
if (i.data.success) {
|
|
133
136
|
if (F)
|
|
134
|
-
|
|
137
|
+
K(i.data.data.resource), R(
|
|
135
138
|
o.formatMessage({
|
|
136
139
|
id: "alert.argument_create",
|
|
137
140
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -147,10 +150,10 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
147
150
|
else {
|
|
148
151
|
const y = i.data.data.resource;
|
|
149
152
|
let L = S;
|
|
150
|
-
t && !m && (L = `argumentList${y.position.id}`),
|
|
153
|
+
t && !m && (L = `argumentList${y.position.id}`), K?.(
|
|
151
154
|
q,
|
|
152
|
-
a.find((
|
|
153
|
-
), N.add(L, [y]),
|
|
155
|
+
a.find((De) => De.id === t) || null
|
|
156
|
+
), N.add(L, [y]), R(
|
|
154
157
|
o.formatMessage({
|
|
155
158
|
id: "alert.argument_create",
|
|
156
159
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -175,38 +178,38 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
175
178
|
);
|
|
176
179
|
}
|
|
177
180
|
}));
|
|
178
|
-
},
|
|
181
|
+
}, Ue = () => {
|
|
179
182
|
const e = {
|
|
180
183
|
content: q,
|
|
181
|
-
rich_content:
|
|
184
|
+
rich_content: ne,
|
|
182
185
|
source_ids: U?.map((t) => t.id),
|
|
183
186
|
...d && { position_id: d }
|
|
184
187
|
};
|
|
185
|
-
V(e,
|
|
188
|
+
V(e, me) && Q.update("messages", ae, e).then((t) => {
|
|
186
189
|
if (t.data.success) {
|
|
187
190
|
const c = t.data.data.resource;
|
|
188
191
|
let i = S;
|
|
189
|
-
if (
|
|
190
|
-
const y = `argumentList${
|
|
192
|
+
if (M?.is_reply && M?.message_id ? i = `argument_${M.message_id}_reply_list` : d && !m && (i = `argumentList${c.position?.id}`), !M?.is_reply && M?.position?.id != c.position?.id && !m) {
|
|
193
|
+
const y = `argumentList${M.position.id}`, L = `argumentList${c.position.id}`;
|
|
191
194
|
N.remove(y, [c]), N.add(L, [c]);
|
|
192
195
|
} else
|
|
193
196
|
N.update(i, [c]);
|
|
194
|
-
|
|
197
|
+
R(o.formatMessage({ id: "alert.argument_modify" }), {
|
|
195
198
|
type: "success"
|
|
196
|
-
}),
|
|
199
|
+
}), ce();
|
|
197
200
|
}
|
|
198
201
|
});
|
|
199
|
-
},
|
|
200
|
-
if (!
|
|
201
|
-
|
|
202
|
+
}, $e = () => {
|
|
203
|
+
if (!ie) {
|
|
204
|
+
oe(!0);
|
|
202
205
|
const e = setTimeout(() => {
|
|
203
|
-
|
|
206
|
+
oe(!1);
|
|
204
207
|
}, 2e3);
|
|
205
208
|
return () => clearTimeout(e);
|
|
206
209
|
}
|
|
207
|
-
},
|
|
208
|
-
g ?
|
|
209
|
-
},
|
|
210
|
+
}, z = () => {
|
|
211
|
+
g ? k({ loginAction: "argument" }) : re(!0);
|
|
212
|
+
}, qe = () => {
|
|
210
213
|
const e = x.find(
|
|
211
214
|
(t) => t.id === d
|
|
212
215
|
);
|
|
@@ -219,8 +222,8 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
219
222
|
{ position: e.name }
|
|
220
223
|
);
|
|
221
224
|
};
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
-
|
|
225
|
+
return /* @__PURE__ */ v("div", { className: n.inputContainer, children: [
|
|
226
|
+
O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: le ? o.formatMessage({
|
|
224
227
|
id: "input.argument_input.user_banned",
|
|
225
228
|
defaultMessage: "You are banned from the debate space."
|
|
226
229
|
}) : o.formatMessage({
|
|
@@ -231,26 +234,26 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
231
234
|
"div",
|
|
232
235
|
{
|
|
233
236
|
className: I(n.argumentInput, {
|
|
234
|
-
[n.flash]:
|
|
237
|
+
[n.flash]: ie,
|
|
235
238
|
[n.replyInputContainer]: r
|
|
236
239
|
}),
|
|
237
|
-
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref:
|
|
238
|
-
a.length > 0 && C && (!r || !
|
|
240
|
+
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: te, children: /* @__PURE__ */ v("div", { className: n.argumentInputBox, children: [
|
|
241
|
+
a.length > 0 && C && (!r || !j) && /* @__PURE__ */ v("div", { className: n.userPosition, children: [
|
|
239
242
|
/* @__PURE__ */ s("div", { children: o.formatMessage({
|
|
240
243
|
id: "input.position",
|
|
241
244
|
defaultMessage: "Your position"
|
|
242
245
|
}) }),
|
|
243
246
|
/* @__PURE__ */ s(
|
|
244
|
-
|
|
247
|
+
nt,
|
|
245
248
|
{
|
|
246
249
|
activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
|
|
247
250
|
firstLabel: a[0],
|
|
248
251
|
secondLabel: a[1],
|
|
249
|
-
onChange: (e) =>
|
|
252
|
+
onChange: (e) => _(a[e].id)
|
|
250
253
|
}
|
|
251
254
|
)
|
|
252
255
|
] }),
|
|
253
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ v(
|
|
254
257
|
"div",
|
|
255
258
|
{
|
|
256
259
|
className: I(n.argumentTextInputBox, {
|
|
@@ -266,14 +269,14 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
266
269
|
[n.argumentAuthorContainerActivated]: !m && w || r
|
|
267
270
|
}),
|
|
268
271
|
children: !m && w || r ? /* @__PURE__ */ s(
|
|
269
|
-
|
|
272
|
+
at,
|
|
270
273
|
{
|
|
271
274
|
avatarUrl: u.image_url,
|
|
272
275
|
userName: u.full_name,
|
|
273
|
-
size:
|
|
276
|
+
size: he
|
|
274
277
|
}
|
|
275
278
|
) : /* @__PURE__ */ s(
|
|
276
|
-
|
|
279
|
+
st,
|
|
277
280
|
{
|
|
278
281
|
fullName: u?.full_name || o.formatMessage({ id: "default_author.full_name" }),
|
|
279
282
|
avatarUrl: u?.image_url,
|
|
@@ -283,51 +286,51 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
283
286
|
)
|
|
284
287
|
}
|
|
285
288
|
),
|
|
286
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ v(
|
|
287
290
|
"div",
|
|
288
291
|
{
|
|
289
|
-
onClick:
|
|
292
|
+
onClick: z,
|
|
290
293
|
"data-testid": "argument-input",
|
|
291
294
|
className: I(n.textEditorBox, {
|
|
292
295
|
[n.replyTextEditorBox]: r
|
|
293
296
|
}),
|
|
294
297
|
children: [
|
|
295
298
|
/* @__PURE__ */ s(
|
|
296
|
-
|
|
299
|
+
it,
|
|
297
300
|
{
|
|
298
301
|
handleChange: (e, t) => {
|
|
299
|
-
|
|
302
|
+
Ee(e, t);
|
|
300
303
|
},
|
|
301
304
|
handleSourcesChange: (e) => {
|
|
302
|
-
|
|
305
|
+
Ve(e);
|
|
303
306
|
},
|
|
304
|
-
placeholder:
|
|
307
|
+
placeholder: Me,
|
|
305
308
|
"aria-label": o.formatMessage({
|
|
306
309
|
id: "input.argument_input.aria_label",
|
|
307
310
|
defaultMessage: "Message input field"
|
|
308
311
|
}),
|
|
309
|
-
onSubmit:
|
|
312
|
+
onSubmit: Be,
|
|
310
313
|
sources: U,
|
|
311
|
-
hideSourceAction:
|
|
314
|
+
hideSourceAction: _e || g,
|
|
312
315
|
uid: `Argument${b}`,
|
|
313
|
-
onActivation:
|
|
316
|
+
onActivation: z,
|
|
314
317
|
showStylesControls: w,
|
|
315
|
-
disabled:
|
|
316
|
-
maxLength: g ? !1 :
|
|
317
|
-
disableRichText:
|
|
318
|
+
disabled: O || g || le,
|
|
319
|
+
maxLength: g ? !1 : p?.actions?.argumentMaxLength,
|
|
320
|
+
disableRichText: p?.actions?.disableRichText || g,
|
|
318
321
|
shortBar: r,
|
|
319
322
|
hideSubmit: g,
|
|
320
|
-
allowedDomains:
|
|
323
|
+
allowedDomains: p?.allowed_sources,
|
|
321
324
|
active: P,
|
|
322
|
-
autoFocus:
|
|
323
|
-
hideCharCount:
|
|
324
|
-
disableAutoActivate:
|
|
325
|
+
autoFocus: xe,
|
|
326
|
+
hideCharCount: Ae,
|
|
327
|
+
disableAutoActivate: Ce
|
|
325
328
|
}
|
|
326
329
|
),
|
|
327
330
|
E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
|
|
328
331
|
w && x?.find(
|
|
329
332
|
(e) => e.id === d
|
|
330
|
-
) && /* @__PURE__ */
|
|
333
|
+
) && /* @__PURE__ */ v(
|
|
331
334
|
"div",
|
|
332
335
|
{
|
|
333
336
|
className: I(
|
|
@@ -336,7 +339,7 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
336
339
|
),
|
|
337
340
|
children: [
|
|
338
341
|
/* @__PURE__ */ s(
|
|
339
|
-
|
|
342
|
+
ot,
|
|
340
343
|
{
|
|
341
344
|
name: "announcement",
|
|
342
345
|
className: n.warningIcon,
|
|
@@ -344,12 +347,12 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
344
347
|
width: 20
|
|
345
348
|
}
|
|
346
349
|
),
|
|
347
|
-
/* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children:
|
|
350
|
+
/* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: qe() })
|
|
348
351
|
]
|
|
349
352
|
}
|
|
350
353
|
),
|
|
351
|
-
w &&
|
|
352
|
-
|
|
354
|
+
w && G && !be && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
|
|
355
|
+
ge,
|
|
353
356
|
{
|
|
354
357
|
id: "alert.guide_message",
|
|
355
358
|
defaultMessage: "Contributions must comply with our {userCharter}.",
|
|
@@ -358,11 +361,11 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
358
361
|
"a",
|
|
359
362
|
{
|
|
360
363
|
className: n.guideMessage,
|
|
361
|
-
href:
|
|
364
|
+
href: G,
|
|
362
365
|
target: "_blank",
|
|
363
366
|
rel: "noreferrer",
|
|
364
367
|
children: /* @__PURE__ */ s(
|
|
365
|
-
|
|
368
|
+
ge,
|
|
366
369
|
{
|
|
367
370
|
id: "alert.user_charter",
|
|
368
371
|
defaultMessage: "user charter"
|
|
@@ -385,5 +388,5 @@ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
385
388
|
] });
|
|
386
389
|
};
|
|
387
390
|
export {
|
|
388
|
-
|
|
391
|
+
Lt as ArgumentInput
|
|
389
392
|
};
|
|
@@ -1,80 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { $isListNode as R, ListNode as
|
|
3
|
-
import { useLexicalComposerContext as
|
|
4
|
-
import { $isHeadingNode as q, $createQuoteNode as
|
|
5
|
-
import { $setBlocksType as
|
|
6
|
-
import { $getNearestNodeOfType as
|
|
7
|
-
import
|
|
8
|
-
import { $getSelection as
|
|
9
|
-
import { useRef as
|
|
1
|
+
import { jsxs as N, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { $isListNode as R, ListNode as w, INSERT_ORDERED_LIST_COMMAND as B, REMOVE_LIST_COMMAND as D } from "@lexical/list";
|
|
3
|
+
import { useLexicalComposerContext as $ } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { $isHeadingNode as q, $createQuoteNode as K } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as M } from "@lexical/selection";
|
|
6
|
+
import { $getNearestNodeOfType as F, mergeRegister as U } from "@lexical/utils";
|
|
7
|
+
import a from "classnames";
|
|
8
|
+
import { $getSelection as g, $isRangeSelection as P, SELECTION_CHANGE_COMMAND as j, FORMAT_TEXT_COMMAND as h, $createParagraphNode as H } from "lexical";
|
|
9
|
+
import { useRef as Q, useState as c, useCallback as G, useEffect as V } from "react";
|
|
10
10
|
import { useIntl as X } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
12
|
import { Icon as s } from "../../../icons/icon/Icon.js";
|
|
13
13
|
import { Button as z } from "../../../action/button/Button.js";
|
|
14
|
-
const
|
|
15
|
-
const n = X(),
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const d =
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
14
|
+
const me = (l) => {
|
|
15
|
+
const n = X(), y = 1, [o] = $(), C = Q(null), [m, f] = c("paragraph"), [J, T] = c(null), [k, I] = c(!1), [x, A] = c(!1), [S, E] = c(!1), p = l.hideSubmit && l.hideSourceAction && l.disableRichText, b = G(() => {
|
|
16
|
+
const i = g();
|
|
17
|
+
if (P(i)) {
|
|
18
|
+
const d = i.anchor.getNode(), r = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), _ = r.getKey();
|
|
19
|
+
if (o.getElementByKey(_) !== null)
|
|
20
|
+
if (T(_), R(r)) {
|
|
21
|
+
const u = F(d, w), O = u ? u.getTag() : r.getTag();
|
|
22
|
+
f(O);
|
|
23
23
|
} else {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const u = q(r) ? r.getTag() : r.getType();
|
|
25
|
+
f(u);
|
|
26
26
|
}
|
|
27
|
-
I(
|
|
27
|
+
I(i.hasFormat("bold")), A(i.hasFormat("italic")), E(i.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
}, [o]);
|
|
30
|
+
V(() => U(
|
|
31
|
+
o.registerUpdateListener(({ editorState: i }) => {
|
|
32
|
+
i.read(() => {
|
|
33
|
+
b();
|
|
34
34
|
});
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
o.registerCommand(
|
|
37
37
|
j,
|
|
38
|
-
(
|
|
39
|
-
|
|
38
|
+
(i, d) => (b(), !1),
|
|
39
|
+
y
|
|
40
40
|
)
|
|
41
|
-
), [
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const a = b();
|
|
52
|
-
y(a, () => F());
|
|
41
|
+
), [o, b]);
|
|
42
|
+
const L = () => {
|
|
43
|
+
m !== "ol" ? o.dispatchCommand(B) : o.dispatchCommand(D);
|
|
44
|
+
}, v = () => {
|
|
45
|
+
m !== "quote" ? o.update(() => {
|
|
46
|
+
const i = g();
|
|
47
|
+
M(i, () => K());
|
|
48
|
+
}) : o.update(() => {
|
|
49
|
+
const i = g();
|
|
50
|
+
M(i, () => H());
|
|
53
51
|
});
|
|
54
52
|
};
|
|
55
|
-
return p ? null : /* @__PURE__ */
|
|
53
|
+
return p ? null : /* @__PURE__ */ N(
|
|
56
54
|
"div",
|
|
57
55
|
{
|
|
58
|
-
className:
|
|
59
|
-
[e.toolbarIsActive]: p ? !1 :
|
|
56
|
+
className: a(e.toolbar, {
|
|
57
|
+
[e.toolbarIsActive]: p ? !1 : l.isActive
|
|
60
58
|
}),
|
|
61
|
-
ref:
|
|
59
|
+
ref: C,
|
|
62
60
|
children: [
|
|
63
|
-
|
|
61
|
+
l.isActive ? !l.disableRichText && /* @__PURE__ */ N(
|
|
64
62
|
"div",
|
|
65
63
|
{
|
|
66
|
-
className:
|
|
67
|
-
[e.shortBar]:
|
|
64
|
+
className: a(e.iconToolbar, {
|
|
65
|
+
[e.shortBar]: l.shortBar
|
|
68
66
|
}),
|
|
69
67
|
children: [
|
|
70
68
|
/* @__PURE__ */ t(
|
|
71
69
|
"button",
|
|
72
70
|
{
|
|
73
71
|
onClick: () => {
|
|
74
|
-
|
|
72
|
+
o.dispatchCommand(h, "bold");
|
|
75
73
|
},
|
|
76
74
|
type: "button",
|
|
77
|
-
className:
|
|
75
|
+
className: a(e.toolbarItem, { [e.active]: k }),
|
|
78
76
|
"data-testid": "format-bold",
|
|
79
77
|
"aria-label": n.formatMessage({
|
|
80
78
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
@@ -86,7 +84,7 @@ const ce = (i) => {
|
|
|
86
84
|
name: "bold",
|
|
87
85
|
width: 24,
|
|
88
86
|
height: 24,
|
|
89
|
-
className:
|
|
87
|
+
className: a(e.format, e.bold)
|
|
90
88
|
}
|
|
91
89
|
)
|
|
92
90
|
}
|
|
@@ -95,11 +93,11 @@ const ce = (i) => {
|
|
|
95
93
|
"button",
|
|
96
94
|
{
|
|
97
95
|
onClick: () => {
|
|
98
|
-
|
|
96
|
+
o.dispatchCommand(h, "italic");
|
|
99
97
|
},
|
|
100
98
|
type: "button",
|
|
101
|
-
className:
|
|
102
|
-
[e.active]:
|
|
99
|
+
className: a(e.toolbarItem, {
|
|
100
|
+
[e.active]: x
|
|
103
101
|
}),
|
|
104
102
|
"aria-label": n.formatMessage({
|
|
105
103
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
@@ -111,7 +109,7 @@ const ce = (i) => {
|
|
|
111
109
|
name: "italic",
|
|
112
110
|
width: 24,
|
|
113
111
|
height: 24,
|
|
114
|
-
className:
|
|
112
|
+
className: a(e.format, e.italic)
|
|
115
113
|
}
|
|
116
114
|
)
|
|
117
115
|
}
|
|
@@ -120,11 +118,11 @@ const ce = (i) => {
|
|
|
120
118
|
"button",
|
|
121
119
|
{
|
|
122
120
|
onClick: () => {
|
|
123
|
-
|
|
121
|
+
o.dispatchCommand(h, "underline");
|
|
124
122
|
},
|
|
125
123
|
type: "button",
|
|
126
|
-
className:
|
|
127
|
-
[e.active]:
|
|
124
|
+
className: a(e.toolbarItem, {
|
|
125
|
+
[e.active]: S
|
|
128
126
|
}),
|
|
129
127
|
"aria-label": n.formatMessage({
|
|
130
128
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
@@ -136,7 +134,7 @@ const ce = (i) => {
|
|
|
136
134
|
name: "underline",
|
|
137
135
|
width: 24,
|
|
138
136
|
height: 24,
|
|
139
|
-
className:
|
|
137
|
+
className: a(e.format, e.underline)
|
|
140
138
|
}
|
|
141
139
|
)
|
|
142
140
|
}
|
|
@@ -144,9 +142,9 @@ const ce = (i) => {
|
|
|
144
142
|
/* @__PURE__ */ t(
|
|
145
143
|
"button",
|
|
146
144
|
{
|
|
147
|
-
onClick: () =>
|
|
145
|
+
onClick: () => v(),
|
|
148
146
|
type: "button",
|
|
149
|
-
className: e.toolbarItem,
|
|
147
|
+
className: a(e.toolbarItem, { [e.active]: m === "quote" }),
|
|
150
148
|
"aria-label": n.formatMessage({
|
|
151
149
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
152
150
|
defaultMessage: "Add a blockquote"
|
|
@@ -157,7 +155,7 @@ const ce = (i) => {
|
|
|
157
155
|
name: "blockquote",
|
|
158
156
|
width: 24,
|
|
159
157
|
height: 24,
|
|
160
|
-
className:
|
|
158
|
+
className: a(e.format, e.quote)
|
|
161
159
|
}
|
|
162
160
|
)
|
|
163
161
|
}
|
|
@@ -165,9 +163,9 @@ const ce = (i) => {
|
|
|
165
163
|
/* @__PURE__ */ t(
|
|
166
164
|
"button",
|
|
167
165
|
{
|
|
168
|
-
onClick: () =>
|
|
166
|
+
onClick: () => L(),
|
|
169
167
|
type: "button",
|
|
170
|
-
className: e.toolbarItem,
|
|
168
|
+
className: a(e.toolbarItem, { [e.active]: m === "ol" }),
|
|
171
169
|
"aria-label": n.formatMessage({
|
|
172
170
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
173
171
|
defaultMessage: "Insert a numbered list"
|
|
@@ -178,15 +176,15 @@ const ce = (i) => {
|
|
|
178
176
|
name: "orderedList",
|
|
179
177
|
width: 24,
|
|
180
178
|
height: 24,
|
|
181
|
-
className:
|
|
179
|
+
className: a(e.format, e.numberedList)
|
|
182
180
|
}
|
|
183
181
|
)
|
|
184
182
|
}
|
|
185
183
|
),
|
|
186
|
-
!
|
|
184
|
+
!l.hideSourceAction && /* @__PURE__ */ t(
|
|
187
185
|
"button",
|
|
188
186
|
{
|
|
189
|
-
onClick:
|
|
187
|
+
onClick: l.onAddSource,
|
|
190
188
|
type: "button",
|
|
191
189
|
className: e.toolbarItem,
|
|
192
190
|
"aria-label": n.formatMessage({
|
|
@@ -199,7 +197,7 @@ const ce = (i) => {
|
|
|
199
197
|
name: "link",
|
|
200
198
|
width: 20,
|
|
201
199
|
height: 20,
|
|
202
|
-
className:
|
|
200
|
+
className: a(e.format, e.link)
|
|
203
201
|
}
|
|
204
202
|
)
|
|
205
203
|
}
|
|
@@ -207,13 +205,13 @@ const ce = (i) => {
|
|
|
207
205
|
]
|
|
208
206
|
}
|
|
209
207
|
) : null,
|
|
210
|
-
/* @__PURE__ */ t("div", { className: e.actionButton, children:
|
|
208
|
+
/* @__PURE__ */ t("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ t(
|
|
211
209
|
z,
|
|
212
210
|
{
|
|
213
211
|
type: "button",
|
|
214
212
|
"data-testid": "submit-button",
|
|
215
|
-
handleClick:
|
|
216
|
-
className:
|
|
213
|
+
handleClick: l.onSubmit,
|
|
214
|
+
className: a(e.inputSubmitActionButton, e.submitAction),
|
|
217
215
|
"aria-label": n.formatMessage({
|
|
218
216
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
219
217
|
defaultMessage: "Send message"
|
|
@@ -226,5 +224,5 @@ const ce = (i) => {
|
|
|
226
224
|
);
|
|
227
225
|
};
|
|
228
226
|
export {
|
|
229
|
-
|
|
227
|
+
me as ToolbarPlugin
|
|
230
228
|
};
|