@logora/debate 0.3.114 → 0.3.116
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,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as A, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import Ye from "@rooks/use-sessionstorage-state";
|
|
3
|
-
import { useRef as ke, useState as c, useEffect as p, Suspense as
|
|
3
|
+
import { useRef as ke, useState as c, useEffect as p, Suspense as Re, lazy as je } from "react";
|
|
4
4
|
import { useIntl as ze, FormattedMessage as he } from "react-intl";
|
|
5
5
|
import { useLocation as Oe } from "react-router";
|
|
6
|
-
import
|
|
6
|
+
import x from "classnames";
|
|
7
7
|
import n from "./ArgumentInput.module.scss.js";
|
|
8
8
|
import { useDataProvider as Je } from "../../data/data_provider/useDataProvider.js";
|
|
9
9
|
import { useList as Ke } from "../../list/list_provider/useList.js";
|
|
@@ -20,22 +20,22 @@ import { Avatar as st } from "../../user/avatar/Avatar.js";
|
|
|
20
20
|
import { AuthorBox as it } from "../../user/author_box/AuthorBox.js";
|
|
21
21
|
import { TextEditor as ot } from "../text_editor/TextEditor.js";
|
|
22
22
|
import { Icon as rt } from "../../icons/icon/Icon.js";
|
|
23
|
-
const ut =
|
|
24
|
-
argumentListId:
|
|
23
|
+
const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Ft = ({
|
|
24
|
+
argumentListId: N,
|
|
25
25
|
avatarSize: pe = 48,
|
|
26
26
|
disabled: O = !1,
|
|
27
27
|
positions: a = [],
|
|
28
|
-
disabledPositions:
|
|
29
|
-
groupId:
|
|
28
|
+
disabledPositions: y = [],
|
|
29
|
+
groupId: _,
|
|
30
30
|
groupName: _e,
|
|
31
31
|
groupType: J,
|
|
32
32
|
hideSourceAction: Me = !1,
|
|
33
33
|
isReply: r = !1,
|
|
34
34
|
onSubmit: K,
|
|
35
35
|
onUpdate: G,
|
|
36
|
-
parentId:
|
|
36
|
+
parentId: M,
|
|
37
37
|
placeholder: ve,
|
|
38
|
-
positionId:
|
|
38
|
+
positionId: C,
|
|
39
39
|
focusOnInit: be = !1,
|
|
40
40
|
activeOnInit: P = !1,
|
|
41
41
|
userGuideUrl: H,
|
|
@@ -44,31 +44,31 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
44
44
|
disableAutoActivate: we = !1,
|
|
45
45
|
autoFocus: Q = !1
|
|
46
46
|
}) => {
|
|
47
|
-
const o = ze(), X = Je(),
|
|
47
|
+
const o = ze(), X = Je(), T = Ke(), v = Ge(), {
|
|
48
48
|
focus: Z,
|
|
49
49
|
setFocus: ee,
|
|
50
|
-
setReset:
|
|
50
|
+
setReset: Se,
|
|
51
51
|
inputContent: B,
|
|
52
52
|
setInputContent: te,
|
|
53
|
-
setInputRichContent:
|
|
54
|
-
} = He(), { isLoggedIn:
|
|
53
|
+
setInputRichContent: Ie
|
|
54
|
+
} = He(), { isLoggedIn: w, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = ke(null), [V, q] = c([]), [D, U] = c(""), [ae, W] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [S, ue] = c(!1), [I, de] = c({}), [Ne, Y] = c(!1), [f, ye] = Ye(
|
|
55
55
|
"userSide",
|
|
56
56
|
{}
|
|
57
|
-
), [g,
|
|
58
|
-
!
|
|
59
|
-
), k = et(), { showModal: Le } = tt(), { toast:
|
|
57
|
+
), [g, Te] = c(
|
|
58
|
+
!w && v?.actions?.disableInputForVisitor
|
|
59
|
+
), k = et(), { showModal: Le } = tt(), { toast: R } = nt() || {}, le = new URLSearchParams(
|
|
60
60
|
typeof window < "u" ? window.location.search : xe.search
|
|
61
61
|
);
|
|
62
62
|
p(() => {
|
|
63
|
-
|
|
64
|
-
!
|
|
63
|
+
Te(
|
|
64
|
+
!w && v?.actions?.disableInputForVisitor
|
|
65
65
|
);
|
|
66
|
-
}, [
|
|
67
|
-
const
|
|
66
|
+
}, [w, v]);
|
|
67
|
+
const j = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
|
|
68
68
|
p(() => {
|
|
69
69
|
let e = null;
|
|
70
|
-
typeof window < "u" && (e = le.get("positionId")),
|
|
71
|
-
}, [
|
|
70
|
+
typeof window < "u" && (e = le.get("positionId")), C && C != a[2]?.id && a?.find((t) => t.id === C) ? b(C) : e && e != a[2]?.id ? b(e) : f && f.groupId == _ && f.positionId != a[2]?.id && b(f.positionId);
|
|
71
|
+
}, [C]), p(() => {
|
|
72
72
|
Q && Y(!0);
|
|
73
73
|
}, [Q]), p(() => {
|
|
74
74
|
P && (z(), Y(!0), L());
|
|
@@ -83,16 +83,16 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
83
83
|
B?.id && (Fe(B), ee(!0));
|
|
84
84
|
}, [B]);
|
|
85
85
|
const Fe = (e) => {
|
|
86
|
-
de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content), ie(e.id), L(),
|
|
86
|
+
de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content), ie(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : te(e.content);
|
|
87
87
|
}, L = () => {
|
|
88
88
|
ne.current.scrollIntoView(!1);
|
|
89
89
|
}, me = () => {
|
|
90
|
-
U(""), W(null), de({}), ie(null), q([]),
|
|
90
|
+
U(""), W(null), de({}), ie(null), q([]), Se(!0), te(null);
|
|
91
91
|
}, Pe = (e) => {
|
|
92
|
-
|
|
92
|
+
b(e), ge(e);
|
|
93
93
|
}, Be = () => {
|
|
94
94
|
Le(
|
|
95
|
-
/* @__PURE__ */ s(
|
|
95
|
+
/* @__PURE__ */ s(Re, { fallback: null, children: /* @__PURE__ */ s(
|
|
96
96
|
ut,
|
|
97
97
|
{
|
|
98
98
|
modalTitle: o.formatMessage({
|
|
@@ -102,16 +102,16 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
102
102
|
onChooseSide: Pe,
|
|
103
103
|
positions: a,
|
|
104
104
|
title: _e,
|
|
105
|
-
disabledPositions: !r &&
|
|
106
|
-
isNeutral: f && f.groupId ==
|
|
105
|
+
disabledPositions: !r && y,
|
|
106
|
+
isNeutral: f && f.groupId == _ && f.positionId === a[2]?.id
|
|
107
107
|
}
|
|
108
108
|
) })
|
|
109
109
|
);
|
|
110
110
|
}, Ee = () => {
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
g ? k({ loginAction: "argument" }) : (U(e), W(t),
|
|
114
|
-
},
|
|
111
|
+
w ? se ? qe() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d || j && r ? ge(r && j && a[0]?.id) : Be() : k({ loginAction: "argument" });
|
|
112
|
+
}, $e = (e, t) => {
|
|
113
|
+
g ? k({ loginAction: "argument" }) : (U(e), W(t), $({ content: e }, [{ content: ["url", null] }]));
|
|
114
|
+
}, Ve = (e) => {
|
|
115
115
|
q(e);
|
|
116
116
|
}, fe = [
|
|
117
117
|
{ content: ["length", 3] },
|
|
@@ -122,20 +122,20 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
122
122
|
const t = e || d, l = {
|
|
123
123
|
content: D,
|
|
124
124
|
rich_content: ae,
|
|
125
|
-
group_id:
|
|
125
|
+
group_id: _,
|
|
126
126
|
...J && { group_type: J },
|
|
127
127
|
...t && { position_id: t },
|
|
128
|
-
is_reply: !!
|
|
129
|
-
message_id:
|
|
130
|
-
source_ids:
|
|
128
|
+
is_reply: !!M,
|
|
129
|
+
message_id: M || null,
|
|
130
|
+
source_ids: V?.map((i) => i.id)
|
|
131
131
|
};
|
|
132
|
-
|
|
133
|
-
groupId:
|
|
132
|
+
$(l, fe) && (t && a && a.map((i) => i.id).includes(t) && ye({
|
|
133
|
+
groupId: _,
|
|
134
134
|
positionId: t
|
|
135
135
|
}), me(), X.create("messages", l).then((i) => {
|
|
136
136
|
if (i.data.success) {
|
|
137
|
-
if (
|
|
138
|
-
K(i.data.data.resource),
|
|
137
|
+
if (M)
|
|
138
|
+
K(i.data.data.resource), R(
|
|
139
139
|
o.formatMessage({
|
|
140
140
|
id: "alert.argument_create",
|
|
141
141
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -150,11 +150,11 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
150
150
|
);
|
|
151
151
|
else {
|
|
152
152
|
const h = i.data.data.resource;
|
|
153
|
-
let F =
|
|
153
|
+
let F = N;
|
|
154
154
|
t && !m && (F = `argumentList${h.position.id}`), K?.(
|
|
155
155
|
D,
|
|
156
156
|
a.find((We) => We.id === t) || null
|
|
157
|
-
),
|
|
157
|
+
), T.add(F, [h]), R(
|
|
158
158
|
o.formatMessage({
|
|
159
159
|
id: "alert.argument_create",
|
|
160
160
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -183,23 +183,23 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
183
183
|
const e = {
|
|
184
184
|
content: D,
|
|
185
185
|
rich_content: ae,
|
|
186
|
-
source_ids:
|
|
186
|
+
source_ids: V?.map((t) => t.id),
|
|
187
187
|
...d && { position_id: d }
|
|
188
188
|
};
|
|
189
|
-
|
|
189
|
+
$(e, fe) && X.update("messages", se, e).then((t) => {
|
|
190
190
|
if (t.data.success) {
|
|
191
191
|
const l = t.data.data.resource;
|
|
192
|
-
let i =
|
|
192
|
+
let i = N;
|
|
193
193
|
if (I?.is_reply || r) {
|
|
194
|
-
const h = I?.message_id ||
|
|
194
|
+
const h = I?.message_id || M;
|
|
195
195
|
h && (i = `argument_${h}_reply_list`);
|
|
196
196
|
} else d && !m && (i = `argumentList${l.position?.id}`);
|
|
197
197
|
if (!I?.is_reply && I?.position?.id != l.position?.id && !m) {
|
|
198
198
|
const h = `argumentList${I.position.id}`, F = `argumentList${l.position.id}`;
|
|
199
|
-
|
|
199
|
+
T.remove(h, [l]), T.add(F, [l]);
|
|
200
200
|
} else
|
|
201
|
-
|
|
202
|
-
G && G(l),
|
|
201
|
+
T.update(i, [l]);
|
|
202
|
+
G && G(l), R(o.formatMessage({ id: "alert.argument_modify" }), {
|
|
203
203
|
type: "success"
|
|
204
204
|
}), me();
|
|
205
205
|
}
|
|
@@ -215,7 +215,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
215
215
|
}, z = () => {
|
|
216
216
|
g ? k({ loginAction: "argument" }) : ue(!0);
|
|
217
217
|
}, Ue = () => {
|
|
218
|
-
const e =
|
|
218
|
+
const e = y.find(
|
|
219
219
|
(t) => t.id === d
|
|
220
220
|
);
|
|
221
221
|
if (e)
|
|
@@ -227,7 +227,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
227
227
|
{ position: e.name }
|
|
228
228
|
);
|
|
229
229
|
};
|
|
230
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ A("div", { className: n.inputContainer, children: [
|
|
231
231
|
O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? o.formatMessage({
|
|
232
232
|
id: "input.argument_input.user_banned",
|
|
233
233
|
defaultMessage: "You are banned from the debate space."
|
|
@@ -238,12 +238,12 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
238
238
|
/* @__PURE__ */ s(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
241
|
-
className:
|
|
241
|
+
className: x(n.argumentInput, {
|
|
242
242
|
[n.flash]: oe,
|
|
243
243
|
[n.replyInputContainer]: r
|
|
244
244
|
}),
|
|
245
|
-
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */
|
|
246
|
-
a.length > 0 &&
|
|
245
|
+
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ A("div", { className: n.argumentInputBox, children: [
|
|
246
|
+
a.length > 0 && w && (!r || !j) && /* @__PURE__ */ A("div", { className: n.userPosition, children: [
|
|
247
247
|
/* @__PURE__ */ s("div", { children: o.formatMessage({
|
|
248
248
|
id: "input.position",
|
|
249
249
|
defaultMessage: "Your position"
|
|
@@ -254,14 +254,14 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
254
254
|
activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
|
|
255
255
|
firstLabel: a[0],
|
|
256
256
|
secondLabel: a[1],
|
|
257
|
-
onChange: (e) =>
|
|
257
|
+
onChange: (e) => b(a[e].id)
|
|
258
258
|
}
|
|
259
259
|
)
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ A(
|
|
262
262
|
"div",
|
|
263
263
|
{
|
|
264
|
-
className:
|
|
264
|
+
className: x(n.argumentTextInputBox, {
|
|
265
265
|
[n.argumentTextInputBoxisTablet]: !m,
|
|
266
266
|
[n.replyEditorRow]: r
|
|
267
267
|
}),
|
|
@@ -269,11 +269,11 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
269
269
|
/* @__PURE__ */ s(
|
|
270
270
|
"div",
|
|
271
271
|
{
|
|
272
|
-
className:
|
|
272
|
+
className: x(n.argumentAuthorContainer, {
|
|
273
273
|
[n.argumentAuthorContainerMobile]: m,
|
|
274
|
-
[n.argumentAuthorContainerActivated]: !m &&
|
|
274
|
+
[n.argumentAuthorContainerActivated]: !m && S || r
|
|
275
275
|
}),
|
|
276
|
-
children: !m &&
|
|
276
|
+
children: !m && S || r ? /* @__PURE__ */ s(
|
|
277
277
|
st,
|
|
278
278
|
{
|
|
279
279
|
avatarUrl: u.image_url,
|
|
@@ -291,12 +291,12 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
291
291
|
)
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ A(
|
|
295
295
|
"div",
|
|
296
296
|
{
|
|
297
297
|
onClick: z,
|
|
298
298
|
"data-testid": "argument-input",
|
|
299
|
-
className:
|
|
299
|
+
className: x(n.textEditorBox, {
|
|
300
300
|
[n.replyTextEditorBox]: r
|
|
301
301
|
}),
|
|
302
302
|
children: [
|
|
@@ -304,10 +304,10 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
304
304
|
ot,
|
|
305
305
|
{
|
|
306
306
|
handleChange: (e, t) => {
|
|
307
|
-
|
|
307
|
+
$e(e, t);
|
|
308
308
|
},
|
|
309
309
|
handleSourcesChange: (e) => {
|
|
310
|
-
|
|
310
|
+
Ve(e);
|
|
311
311
|
},
|
|
312
312
|
placeholder: ve,
|
|
313
313
|
"aria-label": o.formatMessage({
|
|
@@ -315,17 +315,17 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
315
315
|
defaultMessage: "Message input field"
|
|
316
316
|
}),
|
|
317
317
|
onSubmit: Ee,
|
|
318
|
-
sources:
|
|
318
|
+
sources: V,
|
|
319
319
|
hideSourceAction: Me || g,
|
|
320
|
-
uid: `Argument${
|
|
320
|
+
uid: M ? `Reply${_}_${M}` : `Argument${_}`,
|
|
321
321
|
onActivation: z,
|
|
322
|
-
showStylesControls:
|
|
322
|
+
showStylesControls: S,
|
|
323
323
|
disabled: O || g || ce,
|
|
324
|
-
maxLength: g ? !1 :
|
|
325
|
-
disableRichText:
|
|
324
|
+
maxLength: g ? !1 : v?.actions?.argumentMaxLength,
|
|
325
|
+
disableRichText: v?.actions?.disableRichText || g,
|
|
326
326
|
shortBar: r,
|
|
327
327
|
hideSubmit: g,
|
|
328
|
-
allowedDomains:
|
|
328
|
+
allowedDomains: v?.allowed_sources,
|
|
329
329
|
active: P,
|
|
330
330
|
autoFocus: Ne,
|
|
331
331
|
hideCharCount: Ce,
|
|
@@ -333,12 +333,12 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
333
333
|
}
|
|
334
334
|
),
|
|
335
335
|
E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
|
|
336
|
-
|
|
336
|
+
S && y?.find(
|
|
337
337
|
(e) => e.id === d
|
|
338
|
-
) && /* @__PURE__ */
|
|
338
|
+
) && /* @__PURE__ */ A(
|
|
339
339
|
"div",
|
|
340
340
|
{
|
|
341
|
-
className:
|
|
341
|
+
className: x(
|
|
342
342
|
n.argumentInputWarning,
|
|
343
343
|
n.disabledPositionWarning
|
|
344
344
|
),
|
|
@@ -356,7 +356,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ def
|
|
|
356
356
|
]
|
|
357
357
|
}
|
|
358
358
|
),
|
|
359
|
-
|
|
359
|
+
S && H && !Ae && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
|
|
360
360
|
he,
|
|
361
361
|
{
|
|
362
362
|
id: "alert.guide_message",
|
|
@@ -1,100 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { $isListNode as $, ListNode as q, INSERT_ORDERED_LIST_COMMAND as K, REMOVE_LIST_COMMAND as F } from "@lexical/list";
|
|
3
3
|
import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { $isHeadingNode as P, $createQuoteNode as
|
|
5
|
-
import { $setBlocksType as
|
|
4
|
+
import { $isHeadingNode as P, $createQuoteNode as x } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as E } from "@lexical/selection";
|
|
6
6
|
import { $getNearestNodeOfType as j, mergeRegister as H } from "@lexical/utils";
|
|
7
7
|
import a from "classnames";
|
|
8
|
-
import { $getSelection as
|
|
8
|
+
import { $getSelection as f, $isRangeSelection as p, SELECTION_CHANGE_COMMAND as Q, FORMAT_TEXT_COMMAND as V, $createParagraphNode as G } from "lexical";
|
|
9
9
|
import { useRef as X, useState as m, useCallback as z, useEffect as J } from "react";
|
|
10
10
|
import { useIntl as W } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
|
-
import { Icon as
|
|
12
|
+
import { Icon as d } from "../../../icons/icon/Icon.js";
|
|
13
13
|
import { Button as Y } from "../../../action/button/Button.js";
|
|
14
|
-
const he = (
|
|
15
|
-
const
|
|
16
|
-
const t =
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
const g = j(
|
|
22
|
-
|
|
14
|
+
const he = (s) => {
|
|
15
|
+
const c = W(), I = 1, [i] = U(), A = X(null), [b, M] = m("paragraph"), [Z, v] = m(null), [w, T] = m(!1), [D, _] = m(!1), [L, S] = m(!1), y = s.hideSubmit && s.hideSourceAction && s.disableRichText, h = z(() => {
|
|
16
|
+
const t = f();
|
|
17
|
+
if (p(t)) {
|
|
18
|
+
const r = t.anchor.getNode(), n = r.getKey() === "root" ? r : r.getTopLevelElementOrThrow(), u = n.getKey();
|
|
19
|
+
if (i.getElementByKey(u) !== null)
|
|
20
|
+
if (v(u), $(n)) {
|
|
21
|
+
const g = j(r, q), B = g ? g.getTag() : n.getTag();
|
|
22
|
+
M(B);
|
|
23
23
|
} else {
|
|
24
|
-
const g = P(
|
|
25
|
-
|
|
24
|
+
const g = P(n) ? n.getTag() : n.getType();
|
|
25
|
+
M(g);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
T(t.hasFormat("bold")), _(t.hasFormat("italic")), S(t.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
29
|
+
}, [i]);
|
|
30
30
|
J(() => H(
|
|
31
|
-
|
|
31
|
+
i.registerUpdateListener(({ editorState: t }) => {
|
|
32
32
|
t.read(() => {
|
|
33
33
|
h();
|
|
34
34
|
});
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
i.registerCommand(
|
|
37
37
|
Q,
|
|
38
38
|
() => (h(), !1),
|
|
39
|
-
|
|
39
|
+
I
|
|
40
40
|
)
|
|
41
|
-
), [
|
|
42
|
-
const
|
|
41
|
+
), [i, h]);
|
|
42
|
+
const l = (t) => {
|
|
43
43
|
t.preventDefault();
|
|
44
|
-
},
|
|
44
|
+
}, C = () => {
|
|
45
45
|
setTimeout(() => {
|
|
46
|
-
|
|
46
|
+
i.getEditorState().read(() => {
|
|
47
47
|
h();
|
|
48
48
|
});
|
|
49
49
|
}, 0);
|
|
50
|
-
},
|
|
51
|
-
|
|
50
|
+
}, N = (t) => {
|
|
51
|
+
i.getEditorState().read(() => {
|
|
52
|
+
const r = f();
|
|
53
|
+
if (!p(r))
|
|
54
|
+
return;
|
|
55
|
+
const n = !r.hasFormat(t);
|
|
56
|
+
i.dispatchCommand(V, t), t === "bold" && T(n), t === "italic" && _(n), t === "underline" && S(n);
|
|
57
|
+
});
|
|
52
58
|
}, O = () => {
|
|
53
|
-
b !== "ol" ?
|
|
59
|
+
b !== "ol" ? i.dispatchCommand(K) : i.dispatchCommand(F), C();
|
|
54
60
|
}, R = () => {
|
|
55
|
-
b !== "quote" ?
|
|
56
|
-
const t =
|
|
57
|
-
if (
|
|
61
|
+
b !== "quote" ? i.update(() => {
|
|
62
|
+
const t = f();
|
|
63
|
+
if (p(t))
|
|
58
64
|
if (t.isCollapsed()) {
|
|
59
|
-
const
|
|
60
|
-
|
|
65
|
+
const n = t.anchor.getNode().getTopLevelElementOrThrow(), u = x();
|
|
66
|
+
n.insertAfter(u), u.selectEnd();
|
|
61
67
|
} else
|
|
62
|
-
|
|
63
|
-
}) :
|
|
64
|
-
const t =
|
|
65
|
-
|
|
66
|
-
}),
|
|
68
|
+
E(t, () => x());
|
|
69
|
+
}) : i.update(() => {
|
|
70
|
+
const t = f();
|
|
71
|
+
p(t) && E(t, () => G());
|
|
72
|
+
}), C();
|
|
67
73
|
};
|
|
68
|
-
return
|
|
74
|
+
return y ? null : /* @__PURE__ */ k(
|
|
69
75
|
"div",
|
|
70
76
|
{
|
|
71
77
|
className: a(e.toolbar, {
|
|
72
|
-
[e.toolbarIsActive]:
|
|
78
|
+
[e.toolbarIsActive]: y ? !1 : s.isActive
|
|
73
79
|
}),
|
|
74
|
-
ref:
|
|
80
|
+
ref: A,
|
|
75
81
|
children: [
|
|
76
|
-
|
|
82
|
+
s.isActive ? !s.disableRichText && /* @__PURE__ */ k(
|
|
77
83
|
"div",
|
|
78
84
|
{
|
|
79
85
|
className: a(e.iconToolbar, {
|
|
80
|
-
[e.shortBar]:
|
|
86
|
+
[e.shortBar]: s.shortBar
|
|
81
87
|
}),
|
|
82
88
|
children: [
|
|
83
89
|
/* @__PURE__ */ o(
|
|
84
90
|
"button",
|
|
85
91
|
{
|
|
86
|
-
onTouchStart:
|
|
87
|
-
onMouseDown:
|
|
88
|
-
onClick: () =>
|
|
92
|
+
onTouchStart: l,
|
|
93
|
+
onMouseDown: l,
|
|
94
|
+
onClick: () => N("bold"),
|
|
89
95
|
type: "button",
|
|
90
|
-
className: a(e.toolbarItem, { [e.active]:
|
|
96
|
+
className: a(e.toolbarItem, { [e.active]: w }),
|
|
91
97
|
"data-testid": "format-bold",
|
|
92
|
-
"aria-label":
|
|
98
|
+
"aria-label": c.formatMessage({
|
|
93
99
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
94
100
|
defaultMessage: "Make text bold"
|
|
95
101
|
}),
|
|
96
102
|
children: /* @__PURE__ */ o(
|
|
97
|
-
|
|
103
|
+
d,
|
|
98
104
|
{
|
|
99
105
|
name: "bold",
|
|
100
106
|
width: 24,
|
|
@@ -107,19 +113,19 @@ const he = (l) => {
|
|
|
107
113
|
/* @__PURE__ */ o(
|
|
108
114
|
"button",
|
|
109
115
|
{
|
|
110
|
-
onTouchStart:
|
|
111
|
-
onMouseDown:
|
|
112
|
-
onClick: () =>
|
|
116
|
+
onTouchStart: l,
|
|
117
|
+
onMouseDown: l,
|
|
118
|
+
onClick: () => N("italic"),
|
|
113
119
|
type: "button",
|
|
114
120
|
className: a(e.toolbarItem, {
|
|
115
|
-
[e.active]:
|
|
121
|
+
[e.active]: D
|
|
116
122
|
}),
|
|
117
|
-
"aria-label":
|
|
123
|
+
"aria-label": c.formatMessage({
|
|
118
124
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
119
125
|
defaultMessage: "Make text italic"
|
|
120
126
|
}),
|
|
121
127
|
children: /* @__PURE__ */ o(
|
|
122
|
-
|
|
128
|
+
d,
|
|
123
129
|
{
|
|
124
130
|
name: "italic",
|
|
125
131
|
width: 24,
|
|
@@ -132,19 +138,19 @@ const he = (l) => {
|
|
|
132
138
|
/* @__PURE__ */ o(
|
|
133
139
|
"button",
|
|
134
140
|
{
|
|
135
|
-
onTouchStart:
|
|
136
|
-
onMouseDown:
|
|
137
|
-
onClick: () =>
|
|
141
|
+
onTouchStart: l,
|
|
142
|
+
onMouseDown: l,
|
|
143
|
+
onClick: () => N("underline"),
|
|
138
144
|
type: "button",
|
|
139
145
|
className: a(e.toolbarItem, {
|
|
140
|
-
[e.active]:
|
|
146
|
+
[e.active]: L
|
|
141
147
|
}),
|
|
142
|
-
"aria-label":
|
|
148
|
+
"aria-label": c.formatMessage({
|
|
143
149
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
144
150
|
defaultMessage: "Underline text"
|
|
145
151
|
}),
|
|
146
152
|
children: /* @__PURE__ */ o(
|
|
147
|
-
|
|
153
|
+
d,
|
|
148
154
|
{
|
|
149
155
|
name: "underline",
|
|
150
156
|
width: 24,
|
|
@@ -157,19 +163,19 @@ const he = (l) => {
|
|
|
157
163
|
/* @__PURE__ */ o(
|
|
158
164
|
"button",
|
|
159
165
|
{
|
|
160
|
-
onTouchStart:
|
|
161
|
-
onMouseDown:
|
|
166
|
+
onTouchStart: l,
|
|
167
|
+
onMouseDown: l,
|
|
162
168
|
onClick: () => R(),
|
|
163
169
|
type: "button",
|
|
164
170
|
className: a(e.toolbarItem, {
|
|
165
171
|
[e.active]: b === "quote"
|
|
166
172
|
}),
|
|
167
|
-
"aria-label":
|
|
173
|
+
"aria-label": c.formatMessage({
|
|
168
174
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
169
175
|
defaultMessage: "Add a blockquote"
|
|
170
176
|
}),
|
|
171
177
|
children: /* @__PURE__ */ o(
|
|
172
|
-
|
|
178
|
+
d,
|
|
173
179
|
{
|
|
174
180
|
name: "blockquote",
|
|
175
181
|
width: 24,
|
|
@@ -182,19 +188,19 @@ const he = (l) => {
|
|
|
182
188
|
/* @__PURE__ */ o(
|
|
183
189
|
"button",
|
|
184
190
|
{
|
|
185
|
-
onTouchStart:
|
|
186
|
-
onMouseDown:
|
|
191
|
+
onTouchStart: l,
|
|
192
|
+
onMouseDown: l,
|
|
187
193
|
onClick: () => O(),
|
|
188
194
|
type: "button",
|
|
189
195
|
className: a(e.toolbarItem, {
|
|
190
196
|
[e.active]: b === "ol"
|
|
191
197
|
}),
|
|
192
|
-
"aria-label":
|
|
198
|
+
"aria-label": c.formatMessage({
|
|
193
199
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
194
200
|
defaultMessage: "Insert a numbered list"
|
|
195
201
|
}),
|
|
196
202
|
children: /* @__PURE__ */ o(
|
|
197
|
-
|
|
203
|
+
d,
|
|
198
204
|
{
|
|
199
205
|
name: "orderedList",
|
|
200
206
|
width: 24,
|
|
@@ -204,20 +210,20 @@ const he = (l) => {
|
|
|
204
210
|
)
|
|
205
211
|
}
|
|
206
212
|
),
|
|
207
|
-
!
|
|
213
|
+
!s.hideSourceAction && /* @__PURE__ */ o(
|
|
208
214
|
"button",
|
|
209
215
|
{
|
|
210
|
-
onTouchStart:
|
|
211
|
-
onMouseDown:
|
|
212
|
-
onClick:
|
|
216
|
+
onTouchStart: l,
|
|
217
|
+
onMouseDown: l,
|
|
218
|
+
onClick: s.onAddSource,
|
|
213
219
|
type: "button",
|
|
214
220
|
className: e.toolbarItem,
|
|
215
|
-
"aria-label":
|
|
221
|
+
"aria-label": c.formatMessage({
|
|
216
222
|
id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
|
|
217
223
|
defaultMessage: "Add hyperlink"
|
|
218
224
|
}),
|
|
219
225
|
children: /* @__PURE__ */ o(
|
|
220
|
-
|
|
226
|
+
d,
|
|
221
227
|
{
|
|
222
228
|
name: "link",
|
|
223
229
|
width: 20,
|
|
@@ -230,18 +236,18 @@ const he = (l) => {
|
|
|
230
236
|
]
|
|
231
237
|
}
|
|
232
238
|
) : null,
|
|
233
|
-
/* @__PURE__ */ o("div", { className: e.actionButton, children:
|
|
239
|
+
/* @__PURE__ */ o("div", { className: e.actionButton, children: s.hideSubmit ? null : /* @__PURE__ */ o(
|
|
234
240
|
Y,
|
|
235
241
|
{
|
|
236
242
|
type: "button",
|
|
237
243
|
"data-testid": "submit-button",
|
|
238
|
-
handleClick:
|
|
244
|
+
handleClick: s.onSubmit,
|
|
239
245
|
className: a(e.inputSubmitActionButton, e.submitAction),
|
|
240
|
-
"aria-label":
|
|
246
|
+
"aria-label": c.formatMessage({
|
|
241
247
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
242
248
|
defaultMessage: "Send message"
|
|
243
249
|
}),
|
|
244
|
-
children: /* @__PURE__ */ o(
|
|
250
|
+
children: /* @__PURE__ */ o(d, { name: "send", width: 20, height: 20 })
|
|
245
251
|
}
|
|
246
252
|
) })
|
|
247
253
|
]
|