@logora/debate 0.3.113 → 0.3.115

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 v, jsx as s } from "react/jsx-runtime";
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 je, lazy as Re } from "react";
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 S from "classnames";
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 = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ default: x.SideModal }))), Ft = ({
24
- argumentListId: x,
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: N = [],
29
- groupId: b,
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: T,
36
+ parentId: M,
37
37
  placeholder: ve,
38
- positionId: A,
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(), y = Ke(), _ = Ge(), {
47
+ const o = ze(), X = Je(), T = Ke(), v = Ge(), {
48
48
  focus: Z,
49
49
  setFocus: ee,
50
- setReset: Ie,
50
+ setReset: Se,
51
51
  inputContent: B,
52
52
  setInputContent: te,
53
- setInputRichContent: Se
54
- } = He(), { isLoggedIn: C, currentUser: u } = Qe(), { errors: E, validate: V } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = ke(null), [$, q] = c([]), [D, U] = c(""), [ae, W] = c(null), [d, M] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [w, ue] = c(!1), [I, de] = c({}), [Ne, Y] = c(!1), [f, Te] = Ye(
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, ye] = c(
58
- !C && _?.actions?.disableInputForVisitor
59
- ), k = et(), { showModal: Le } = tt(), { toast: j } = nt() || {}, le = new URLSearchParams(
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
- ye(
64
- !C && _?.actions?.disableInputForVisitor
63
+ Te(
64
+ !w && v?.actions?.disableInputForVisitor
65
65
  );
66
- }, [C, _]);
67
- const R = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
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")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? M(A) : e && e != a[2]?.id ? M(e) : f && f.groupId == b && f.positionId != a[2]?.id && M(f.positionId);
71
- }, [A]), p(() => {
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(), M(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Se(e.rich_content) : te(e.content);
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([]), Ie(!0), te(null);
90
+ U(""), W(null), de({}), ie(null), q([]), Se(!0), te(null);
91
91
  }, Pe = (e) => {
92
- M(e), ge(e);
92
+ b(e), ge(e);
93
93
  }, Be = () => {
94
94
  Le(
95
- /* @__PURE__ */ s(je, { fallback: null, children: /* @__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 && N,
106
- isNeutral: f && f.groupId == b && f.positionId === a[2]?.id
105
+ disabledPositions: !r && y,
106
+ isNeutral: f && f.groupId == _ && f.positionId === a[2]?.id
107
107
  }
108
108
  ) })
109
109
  );
110
110
  }, Ee = () => {
111
- C ? se ? qe() : !a || a?.length === 0 || !N?.find((e) => e?.id === d) && d || R && r ? ge(r && R && a[0]?.id) : Be() : k({ loginAction: "argument" });
112
- }, Ve = (e, t) => {
113
- g ? k({ loginAction: "argument" }) : (U(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
114
- }, $e = (e) => {
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: b,
125
+ group_id: _,
126
126
  ...J && { group_type: J },
127
127
  ...t && { position_id: t },
128
- is_reply: !!T,
129
- message_id: T || null,
130
- source_ids: $?.map((i) => i.id)
128
+ is_reply: !!M,
129
+ message_id: M || null,
130
+ source_ids: V?.map((i) => i.id)
131
131
  };
132
- V(l, fe) && (t && a && a.map((i) => i.id).includes(t) && Te({
133
- groupId: b,
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 (T)
138
- K(i.data.data.resource), j(
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 = x;
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
- ), y.add(F, [h]), j(
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: $?.map((t) => t.id),
186
+ source_ids: V?.map((t) => t.id),
187
187
  ...d && { position_id: d }
188
188
  };
189
- V(e, fe) && X.update("messages", se, e).then((t) => {
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 = x;
192
+ let i = N;
193
193
  if (I?.is_reply || r) {
194
- const h = I?.message_id || T;
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
- y.remove(h, [l]), y.add(F, [l]);
199
+ T.remove(h, [l]), T.add(F, [l]);
200
200
  } else
201
- y.update(i, [l]);
202
- G && G(l), j(o.formatMessage({ id: "alert.argument_modify" }), {
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 = N.find(
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__ */ v("div", { className: n.inputContainer, children: [
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: S(n.argumentInput, {
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__ */ v("div", { className: n.argumentInputBox, children: [
246
- a.length > 0 && C && (!r || !R) && /* @__PURE__ */ v("div", { className: n.userPosition, children: [
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) => M(a[e].id)
257
+ onChange: (e) => b(a[e].id)
258
258
  }
259
259
  )
260
260
  ] }),
261
- /* @__PURE__ */ v(
261
+ /* @__PURE__ */ A(
262
262
  "div",
263
263
  {
264
- className: S(n.argumentTextInputBox, {
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: S(n.argumentAuthorContainer, {
272
+ className: x(n.argumentAuthorContainer, {
273
273
  [n.argumentAuthorContainerMobile]: m,
274
- [n.argumentAuthorContainerActivated]: !m && w || r
274
+ [n.argumentAuthorContainerActivated]: !m && S || r
275
275
  }),
276
- children: !m && w || r ? /* @__PURE__ */ s(
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__ */ v(
294
+ /* @__PURE__ */ A(
295
295
  "div",
296
296
  {
297
297
  onClick: z,
298
298
  "data-testid": "argument-input",
299
- className: S(n.textEditorBox, {
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
- Ve(e, t);
307
+ $e(e, t);
308
308
  },
309
309
  handleSourcesChange: (e) => {
310
- $e(e);
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${b}`,
320
+ uid: M ? `Reply${_}_${M}` : `Argument${_}`,
321
321
  onActivation: z,
322
- showStylesControls: w,
322
+ showStylesControls: S,
323
323
  disabled: O || g || ce,
324
- maxLength: g ? !1 : _?.actions?.argumentMaxLength,
325
- disableRichText: _?.actions?.disableRichText || g,
324
+ maxLength: g ? !1 : v?.actions?.argumentMaxLength,
325
+ disableRichText: v?.actions?.disableRichText || g,
326
326
  shortBar: r,
327
327
  hideSubmit: g,
328
- allowedDomains: _?.allowed_sources,
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
- w && N?.find(
336
+ S && y?.find(
337
337
  (e) => e.id === d
338
- ) && /* @__PURE__ */ v(
338
+ ) && /* @__PURE__ */ A(
339
339
  "div",
340
340
  {
341
- className: S(
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
- w && H && !Ae && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
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,107 +1,100 @@
1
- import { jsxs as T, jsx as o } from "react/jsx-runtime";
2
- import { $isListNode as q, ListNode as P, INSERT_ORDERED_LIST_COMMAND as $, REMOVE_LIST_COMMAND as K } from "@lexical/list";
3
- import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext";
4
- import { $isHeadingNode as U, $createQuoteNode as k } from "@lexical/rich-text";
5
- import { $setBlocksType as w } from "@lexical/selection";
1
+ import { jsxs as y, jsx as o } from "react/jsx-runtime";
2
+ import { $isListNode as $, ListNode as q, INSERT_ORDERED_LIST_COMMAND as K, REMOVE_LIST_COMMAND as F } from "@lexical/list";
3
+ import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
4
+ import { $isHeadingNode as P, $createQuoteNode as S } from "@lexical/rich-text";
5
+ import { $setBlocksType as C } 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 h, $isRangeSelection as p, SELECTION_CHANGE_COMMAND as Q, $createParagraphNode as G } from "lexical";
9
- import { useRef as V, useState as b, useCallback as z, useEffect as J } from "react";
8
+ import { $getSelection as N, $isRangeSelection as M, SELECTION_CHANGE_COMMAND as Q, FORMAT_TEXT_COMMAND as G, $createParagraphNode as V } from "lexical";
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 d } from "../../../icons/icon/Icon.js";
13
- import { Button as X } from "../../../action/button/Button.js";
14
- const be = (i) => {
15
- const c = W(), x = 1, [n] = F(), C = V(null), [g, _] = b("paragraph"), [Y, D] = b(null), [I, E] = b(!1), [S, v] = b(!1), [A, L] = b(!1), M = i.hideSubmit && i.hideSourceAction && i.disableRichText, m = z(() => {
16
- const t = h();
17
- if (p(t)) {
18
- const s = t.anchor.getNode(), r = s.getKey() === "root" ? s : s.getTopLevelElementOrThrow(), u = r.getKey();
12
+ import { Icon as c } from "../../../icons/icon/Icon.js";
13
+ import { Button as Y } from "../../../action/button/Button.js";
14
+ const he = (l) => {
15
+ const r = W(), k = 1, [n] = U(), x = X(null), [b, T] = m("paragraph"), [Z, I] = m(null), [E, A] = m(!1), [v, w] = m(!1), [D, L] = m(!1), _ = l.hideSubmit && l.hideSourceAction && l.disableRichText, h = z(() => {
16
+ const t = N();
17
+ if (M(t)) {
18
+ const d = t.anchor.getNode(), s = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), u = s.getKey();
19
19
  if (n.getElementByKey(u) !== null)
20
- if (D(u), q(r)) {
21
- const f = j(s, P), R = f ? f.getTag() : r.getTag();
22
- _(R);
20
+ if (I(u), $(s)) {
21
+ const g = j(d, q), B = g ? g.getTag() : s.getTag();
22
+ T(B);
23
23
  } else {
24
- const f = U(r) ? r.getTag() : r.getType();
25
- _(f);
24
+ const g = P(s) ? s.getTag() : s.getType();
25
+ T(g);
26
26
  }
27
- E(t.hasFormat("bold")), v(t.hasFormat("italic")), L(t.hasFormat("underline"));
27
+ A(t.hasFormat("bold")), w(t.hasFormat("italic")), L(t.hasFormat("underline"));
28
28
  }
29
29
  }, [n]);
30
30
  J(() => H(
31
31
  n.registerUpdateListener(({ editorState: t }) => {
32
32
  t.read(() => {
33
- m();
33
+ h();
34
34
  });
35
35
  }),
36
36
  n.registerCommand(
37
37
  Q,
38
- (t, s) => (m(), !1),
39
- x
38
+ () => (h(), !1),
39
+ k
40
40
  )
41
- ), [n, m]);
42
- const l = (t) => {
41
+ ), [n, h]);
42
+ const i = (t) => {
43
43
  t.preventDefault();
44
- }, y = () => {
45
- queueMicrotask(() => {
46
- requestAnimationFrame(() => {
47
- n.getEditorState().read(() => {
48
- m();
49
- });
44
+ }, f = () => {
45
+ setTimeout(() => {
46
+ n.getEditorState().read(() => {
47
+ h();
50
48
  });
51
- });
52
- }, N = (t) => {
53
- n.update(() => {
54
- const s = h();
55
- p(s) && (s.formatText(t), m());
56
- });
49
+ }, 0);
50
+ }, p = (t) => {
51
+ n.dispatchCommand(G, t), f();
57
52
  }, O = () => {
58
- g !== "ol" ? n.dispatchCommand($) : n.dispatchCommand(K), y();
59
- }, B = () => {
60
- g !== "quote" ? n.update(() => {
61
- const t = h();
62
- if (p(t))
53
+ b !== "ol" ? n.dispatchCommand(K) : n.dispatchCommand(F), f();
54
+ }, R = () => {
55
+ b !== "quote" ? n.update(() => {
56
+ const t = N();
57
+ if (M(t))
63
58
  if (t.isCollapsed()) {
64
- const r = t.anchor.getNode().getTopLevelElementOrThrow(), u = k();
65
- r.insertAfter(u), u.selectEnd();
59
+ const s = t.anchor.getNode().getTopLevelElementOrThrow(), u = S();
60
+ s.insertAfter(u), u.selectEnd();
66
61
  } else
67
- w(t, () => k());
62
+ C(t, () => S());
68
63
  }) : n.update(() => {
69
- const t = h();
70
- p(t) && w(t, () => G());
71
- }), y();
64
+ const t = N();
65
+ M(t) && C(t, () => V());
66
+ }), f();
72
67
  };
73
- return M ? null : /* @__PURE__ */ T(
68
+ return _ ? null : /* @__PURE__ */ y(
74
69
  "div",
75
70
  {
76
71
  className: a(e.toolbar, {
77
- [e.toolbarIsActive]: M ? !1 : i.isActive
72
+ [e.toolbarIsActive]: _ ? !1 : l.isActive
78
73
  }),
79
- ref: C,
74
+ ref: x,
80
75
  children: [
81
- i.isActive ? !i.disableRichText && /* @__PURE__ */ T(
76
+ l.isActive ? !l.disableRichText && /* @__PURE__ */ y(
82
77
  "div",
83
78
  {
84
79
  className: a(e.iconToolbar, {
85
- [e.shortBar]: i.shortBar
80
+ [e.shortBar]: l.shortBar
86
81
  }),
87
82
  children: [
88
83
  /* @__PURE__ */ o(
89
84
  "button",
90
85
  {
91
- onPointerDown: l,
92
- onMouseDown: l,
93
- onClick: () => {
94
- N("bold");
95
- },
86
+ onTouchStart: i,
87
+ onMouseDown: i,
88
+ onClick: () => p("bold"),
96
89
  type: "button",
97
- className: a(e.toolbarItem, { [e.active]: I }),
90
+ className: a(e.toolbarItem, { [e.active]: E }),
98
91
  "data-testid": "format-bold",
99
- "aria-label": c.formatMessage({
92
+ "aria-label": r.formatMessage({
100
93
  id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
101
94
  defaultMessage: "Make text bold"
102
95
  }),
103
96
  children: /* @__PURE__ */ o(
104
- d,
97
+ c,
105
98
  {
106
99
  name: "bold",
107
100
  width: 24,
@@ -114,21 +107,19 @@ const be = (i) => {
114
107
  /* @__PURE__ */ o(
115
108
  "button",
116
109
  {
117
- onPointerDown: l,
118
- onMouseDown: l,
119
- onClick: () => {
120
- N("italic");
121
- },
110
+ onTouchStart: i,
111
+ onMouseDown: i,
112
+ onClick: () => p("italic"),
122
113
  type: "button",
123
114
  className: a(e.toolbarItem, {
124
- [e.active]: S
115
+ [e.active]: v
125
116
  }),
126
- "aria-label": c.formatMessage({
117
+ "aria-label": r.formatMessage({
127
118
  id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
128
119
  defaultMessage: "Make text italic"
129
120
  }),
130
121
  children: /* @__PURE__ */ o(
131
- d,
122
+ c,
132
123
  {
133
124
  name: "italic",
134
125
  width: 24,
@@ -141,21 +132,19 @@ const be = (i) => {
141
132
  /* @__PURE__ */ o(
142
133
  "button",
143
134
  {
144
- onPointerDown: l,
145
- onMouseDown: l,
146
- onClick: () => {
147
- N("underline");
148
- },
135
+ onTouchStart: i,
136
+ onMouseDown: i,
137
+ onClick: () => p("underline"),
149
138
  type: "button",
150
139
  className: a(e.toolbarItem, {
151
- [e.active]: A
140
+ [e.active]: D
152
141
  }),
153
- "aria-label": c.formatMessage({
142
+ "aria-label": r.formatMessage({
154
143
  id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
155
144
  defaultMessage: "Underline text"
156
145
  }),
157
146
  children: /* @__PURE__ */ o(
158
- d,
147
+ c,
159
148
  {
160
149
  name: "underline",
161
150
  width: 24,
@@ -168,17 +157,19 @@ const be = (i) => {
168
157
  /* @__PURE__ */ o(
169
158
  "button",
170
159
  {
171
- onPointerDown: l,
172
- onMouseDown: l,
173
- onClick: () => B(),
160
+ onTouchStart: i,
161
+ onMouseDown: i,
162
+ onClick: () => R(),
174
163
  type: "button",
175
- className: a(e.toolbarItem, { [e.active]: g === "quote" }),
176
- "aria-label": c.formatMessage({
164
+ className: a(e.toolbarItem, {
165
+ [e.active]: b === "quote"
166
+ }),
167
+ "aria-label": r.formatMessage({
177
168
  id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
178
169
  defaultMessage: "Add a blockquote"
179
170
  }),
180
171
  children: /* @__PURE__ */ o(
181
- d,
172
+ c,
182
173
  {
183
174
  name: "blockquote",
184
175
  width: 24,
@@ -191,17 +182,19 @@ const be = (i) => {
191
182
  /* @__PURE__ */ o(
192
183
  "button",
193
184
  {
194
- onPointerDown: l,
195
- onMouseDown: l,
185
+ onTouchStart: i,
186
+ onMouseDown: i,
196
187
  onClick: () => O(),
197
188
  type: "button",
198
- className: a(e.toolbarItem, { [e.active]: g === "ol" }),
199
- "aria-label": c.formatMessage({
189
+ className: a(e.toolbarItem, {
190
+ [e.active]: b === "ol"
191
+ }),
192
+ "aria-label": r.formatMessage({
200
193
  id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
201
194
  defaultMessage: "Insert a numbered list"
202
195
  }),
203
196
  children: /* @__PURE__ */ o(
204
- d,
197
+ c,
205
198
  {
206
199
  name: "orderedList",
207
200
  width: 24,
@@ -211,18 +204,20 @@ const be = (i) => {
211
204
  )
212
205
  }
213
206
  ),
214
- !i.hideSourceAction && /* @__PURE__ */ o(
207
+ !l.hideSourceAction && /* @__PURE__ */ o(
215
208
  "button",
216
209
  {
217
- onClick: i.onAddSource,
210
+ onTouchStart: i,
211
+ onMouseDown: i,
212
+ onClick: l.onAddSource,
218
213
  type: "button",
219
214
  className: e.toolbarItem,
220
- "aria-label": c.formatMessage({
215
+ "aria-label": r.formatMessage({
221
216
  id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
222
217
  defaultMessage: "Add hyperlink"
223
218
  }),
224
219
  children: /* @__PURE__ */ o(
225
- d,
220
+ c,
226
221
  {
227
222
  name: "link",
228
223
  width: 20,
@@ -235,18 +230,18 @@ const be = (i) => {
235
230
  ]
236
231
  }
237
232
  ) : null,
238
- /* @__PURE__ */ o("div", { className: e.actionButton, children: i.hideSubmit ? null : /* @__PURE__ */ o(
239
- X,
233
+ /* @__PURE__ */ o("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ o(
234
+ Y,
240
235
  {
241
236
  type: "button",
242
237
  "data-testid": "submit-button",
243
- handleClick: i.onSubmit,
238
+ handleClick: l.onSubmit,
244
239
  className: a(e.inputSubmitActionButton, e.submitAction),
245
- "aria-label": c.formatMessage({
240
+ "aria-label": r.formatMessage({
246
241
  id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
247
242
  defaultMessage: "Send message"
248
243
  }),
249
- children: /* @__PURE__ */ o(d, { name: "send", width: 20, height: 20 })
244
+ children: /* @__PURE__ */ o(c, { name: "send", width: 20, height: 20 })
250
245
  }
251
246
  ) })
252
247
  ]
@@ -254,5 +249,5 @@ const be = (i) => {
254
249
  );
255
250
  };
256
251
  export {
257
- be as ToolbarPlugin
252
+ he as ToolbarPlugin
258
253
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.113",
3
+ "version": "0.3.115",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",