@logora/debate 0.4.74 → 0.4.75

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,8 +1,8 @@
1
1
  import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
2
  import We from "@rooks/use-sessionstorage-state";
3
- import { useRef as Ye, useState as c, useEffect as p, Suspense as je, lazy as Re } from "react";
4
- import { useIntl as ze, FormattedMessage as he } from "react-intl";
5
- import { useLocation as Oe } from "react-router";
3
+ import { useRef as Ye, useState as c, useEffect as p, Suspense as je, lazy as ze } from "react";
4
+ import { useIntl as Oe, FormattedMessage as he } from "react-intl";
5
+ import { useLocation as Re } from "react-router";
6
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";
@@ -20,17 +20,17 @@ 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((N) => ({ default: N.SideModal }))), Ft = ({
23
+ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Ft = ({
24
24
  argumentListId: N,
25
25
  avatarSize: pe = 48,
26
- disabled: O = !1,
26
+ disabled: R = !1,
27
27
  positions: a = [],
28
- disabledPositions: y = [],
28
+ disabledPositions: T = [],
29
29
  groupId: _,
30
30
  groupName: _e,
31
31
  groupType: J,
32
32
  hideSourceAction: Me = !1,
33
- isReply: o = !1,
33
+ isReply: i = !1,
34
34
  onSubmit: K,
35
35
  onUpdate: G,
36
36
  parentId: M,
@@ -44,34 +44,34 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
44
44
  disableAutoActivate: we = !1,
45
45
  autoFocus: Q = !1
46
46
  }) => {
47
- const r = ze(), X = Je(), T = Ke(), v = Ge(), {
47
+ const r = Oe(), X = Je(), y = Ke(), v = Ge(), {
48
48
  focus: Z,
49
49
  setFocus: ee,
50
50
  setReset: Se,
51
51
  inputContent: B,
52
52
  setInputContent: te,
53
53
  setInputRichContent: Ie
54
- } = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = Ye(null), [V, k] = c([]), [q, D] = c(""), [ae, U] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [I, ue] = c(!1), [A, de] = c({}), [Ne, W] = c(!1), [f, ye] = We(
54
+ } = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Re(), ne = Ye(null), [V, k] = c([]), [q, D] = c(""), [ae, U] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [I, ue] = c(!1), [A, de] = c({}), [Ne, W] = c(!1), [f, Te] = We(
55
55
  "userSide",
56
56
  {}
57
- ), [g, Te] = c(
57
+ ), [g, ye] = c(
58
58
  !S && v?.actions?.disableInputForVisitor
59
59
  ), Y = et(), { showModal: Le } = tt(), { toast: j } = nt() || {}, le = new URLSearchParams(
60
60
  typeof window < "u" ? window.location.search : xe.search
61
61
  );
62
62
  p(() => {
63
- Te(
63
+ ye(
64
64
  !S && v?.actions?.disableInputForVisitor
65
65
  );
66
66
  }, [S, v]);
67
- const R = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
67
+ const z = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
68
68
  p(() => {
69
69
  let e = null;
70
70
  typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : f && f.groupId == _ && f.positionId != a[2]?.id && b(f.positionId);
71
71
  }, [w]), p(() => {
72
72
  Q && W(!0);
73
73
  }, [Q]), p(() => {
74
- P && (z(), W(!0), L());
74
+ P && (O(), W(!0), L());
75
75
  }, [P]), p(() => {
76
76
  if (typeof window < "u") {
77
77
  const e = be || le.get("initArgument");
@@ -80,7 +80,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
80
80
  }, []), p(() => {
81
81
  Z && (L(), ee(!1));
82
82
  }, [Z]), p(() => {
83
- B?.id && !o && (Fe(B), ee(!0));
83
+ B?.id && !i && (Fe(B), ee(!0));
84
84
  }, [B]);
85
85
  const Fe = (e) => {
86
86
  de(e), ue(!0), k(e.sources), D(e.content), U(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);
@@ -102,13 +102,13 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
102
102
  onChooseSide: Pe,
103
103
  positions: a,
104
104
  title: _e,
105
- disabledPositions: !o && y,
105
+ disabledPositions: !i && T,
106
106
  isNeutral: f && f.groupId == _ && f.positionId === a[2]?.id
107
107
  }
108
108
  ) })
109
109
  );
110
110
  }, Ee = () => {
111
- S ? se ? ke() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d || R && o ? ge(o && R && a[0]?.id) : Be() : Y({ loginAction: "argument" });
111
+ S ? se ? ke() : !a || a?.length === 0 || !T?.find((e) => e?.id === d) && d || z && i ? ge(i && z && a[0]?.id) : Be() : Y({ loginAction: "argument" });
112
112
  }, $e = (e, t) => {
113
113
  g ? Y({ loginAction: "argument" }) : (D(e), U(t), $({ content: e }, [{ content: ["url", null] }]));
114
114
  }, Ve = (e) => {
@@ -127,15 +127,15 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
127
127
  ...t && { position_id: t },
128
128
  is_reply: !!M,
129
129
  message_id: M || null,
130
- source_ids: V?.map((i) => i.id)
130
+ source_ids: V?.map((o) => o.id)
131
131
  };
132
- $(l, fe) && (t && a && a.map((i) => i.id).includes(t) && ye({
132
+ $(l, fe) && (t && a && a.map((o) => o.id).includes(t) && Te({
133
133
  groupId: _,
134
134
  positionId: t
135
- }), me(), X.create("messages", l).then((i) => {
136
- if (i.data.success) {
135
+ }), me(), X.create("messages", l).then((o) => {
136
+ if (o.data.success) {
137
137
  if (M)
138
- K(i.data.data.resource), j(
138
+ K(o.data.data.resource), j(
139
139
  r.formatMessage({
140
140
  id: "alert.argument_create",
141
141
  defaultMessage: "Your contribution has been sent !"
@@ -149,12 +149,12 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
149
149
  }
150
150
  );
151
151
  else {
152
- const h = i.data.data.resource;
152
+ const h = o.data.data.resource;
153
153
  let F = N;
154
154
  t && !m && (F = `argumentList${h.position.id}`), K?.(
155
155
  q,
156
156
  a.find((Ue) => Ue.id === t) || null
157
- ), T.add(F, [h]), j(
157
+ ), y.add(F, [h]), j(
158
158
  r.formatMessage({
159
159
  id: "alert.argument_create",
160
160
  defaultMessage: "Your contribution has been sent !"
@@ -173,7 +173,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
173
173
  typeof window < "u" && window.dispatchEvent(
174
174
  new CustomEvent("logora:user_content:created", {
175
175
  detail: {
176
- content: i.data.data?.resource
176
+ content: o.data.data?.resource
177
177
  }
178
178
  })
179
179
  );
@@ -189,16 +189,16 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
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 = N;
193
- if (A?.is_reply || o) {
192
+ let o = N;
193
+ if (A?.is_reply || i) {
194
194
  const h = A?.message_id || A?.reply_to_id || M;
195
- h && (i = `argument_${h}_reply_list`);
196
- } else d && !m && (i = `argumentList${l.position?.id}`);
195
+ h && (o = `argument_${h}_reply_list`);
196
+ } else d && !m && (o = `argumentList${l.position?.id}`);
197
197
  if (!A?.is_reply && A?.position?.id != l.position?.id && !m) {
198
198
  const h = `argumentList${A.position.id}`, F = `argumentList${l.position.id}`;
199
- T.remove(h, [l]), T.add(F, [l]);
199
+ y.remove(h, [l]), y.add(F, [l]);
200
200
  } else
201
- T.update(i, [l]);
201
+ y.update(o, [l]);
202
202
  G && G(l), j(r.formatMessage({ id: "alert.argument_modify" }), {
203
203
  type: "success"
204
204
  }), me();
@@ -212,10 +212,10 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
212
212
  }, 2e3);
213
213
  return () => clearTimeout(e);
214
214
  }
215
- }, z = () => {
215
+ }, O = () => {
216
216
  g ? Y({ loginAction: "argument" }) : ue(!0);
217
217
  }, De = () => {
218
- const e = y.find(
218
+ const e = T.find(
219
219
  (t) => t.id === d
220
220
  );
221
221
  if (e)
@@ -228,7 +228,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
228
228
  );
229
229
  };
230
230
  return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
231
- O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
231
+ R && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
232
232
  id: "input.argument_input.user_banned",
233
233
  defaultMessage: "You are banned from the debate space."
234
234
  }) : r.formatMessage({
@@ -240,10 +240,10 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
240
240
  {
241
241
  className: x(n.argumentInput, {
242
242
  [n.flash]: oe,
243
- [n.replyInputContainer]: o
243
+ [n.replyInputContainer]: i
244
244
  }),
245
245
  children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ C("div", { className: n.argumentInputBox, children: [
246
- a.length > 0 && S && (!o || !R) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
246
+ a.length > 0 && S && (!i || !z) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
247
247
  /* @__PURE__ */ s("div", { children: r.formatMessage({
248
248
  id: "input.position",
249
249
  defaultMessage: "Your position"
@@ -263,7 +263,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
263
263
  {
264
264
  className: x(n.argumentTextInputBox, {
265
265
  [n.argumentTextInputBoxisTablet]: !m,
266
- [n.replyEditorRow]: o
266
+ [n.replyEditorRow]: i
267
267
  }),
268
268
  children: [
269
269
  /* @__PURE__ */ s(
@@ -271,9 +271,9 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
271
271
  {
272
272
  className: x(n.argumentAuthorContainer, {
273
273
  [n.argumentAuthorContainerMobile]: m,
274
- [n.argumentAuthorContainerActivated]: !m && I || o
274
+ [n.argumentAuthorContainerActivated]: !m && I || i
275
275
  }),
276
- children: !m && I || o ? /* @__PURE__ */ s(
276
+ children: !m && I || i ? /* @__PURE__ */ s(
277
277
  st,
278
278
  {
279
279
  avatarUrl: u.image_url,
@@ -294,10 +294,10 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
294
294
  /* @__PURE__ */ C(
295
295
  "div",
296
296
  {
297
- onClick: z,
297
+ onClick: O,
298
298
  "data-testid": "argument-input",
299
299
  className: x(n.textEditorBox, {
300
- [n.replyTextEditorBox]: o
300
+ [n.replyTextEditorBox]: i
301
301
  }),
302
302
  children: [
303
303
  /* @__PURE__ */ s(
@@ -318,12 +318,13 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
318
318
  sources: V,
319
319
  hideSourceAction: Me || g,
320
320
  uid: M ? `Reply${_}_${M}` : `Argument${_}`,
321
- onActivation: z,
321
+ onActivation: O,
322
322
  showStylesControls: I,
323
- disabled: O || g || ce,
323
+ disabled: R || g || ce,
324
324
  maxLength: g ? !1 : v?.actions?.argumentMaxLength,
325
325
  disableRichText: v?.actions?.disableRichText || g,
326
- shortBar: o,
326
+ shortBar: i,
327
+ isReply: i,
327
328
  hideSubmit: g,
328
329
  allowedDomains: v?.allowed_sources,
329
330
  active: P,
@@ -333,7 +334,7 @@ const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ def
333
334
  }
334
335
  ),
335
336
  E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
336
- I && y?.find(
337
+ I && T?.find(
337
338
  (e) => e.id === d
338
339
  ) && /* @__PURE__ */ C(
339
340
  "div",
@@ -1,187 +1,188 @@
1
- import { jsxs as S, Fragment as oe, jsx as e } from "react/jsx-runtime";
2
- import { ListNode as re, ListItemNode as ie } from "@lexical/list";
3
- import { OverflowNode as ne } from "@lexical/overflow";
4
- import { CharacterLimitPlugin as se } from "@lexical/react/LexicalCharacterLimitPlugin";
5
- import { LexicalComposer as ce } from "@lexical/react/LexicalComposer";
6
- import { ContentEditable as le } from "@lexical/react/LexicalContentEditable";
7
- import { EditorRefPlugin as me } from "@lexical/react/LexicalEditorRefPlugin";
8
- import { LexicalErrorBoundary as ae } from "@lexical/react/LexicalErrorBoundary";
9
- import { HistoryPlugin as de } from "@lexical/react/LexicalHistoryPlugin";
10
- import { ListPlugin as ue } from "@lexical/react/LexicalListPlugin";
11
- import { OnChangePlugin as fe } from "@lexical/react/LexicalOnChangePlugin";
12
- import { RichTextPlugin as pe } from "@lexical/react/LexicalRichTextPlugin";
13
- import { QuoteNode as he } from "@lexical/rich-text";
14
- import b from "classnames";
15
- import { $getRoot as ge } from "lexical";
16
- import { useState as f, useId as Se, useRef as xe, useEffect as M } from "react";
17
- import { useIntl as Pe } from "react-intl";
18
- import Ce from "./EditorTheme.js";
1
+ import { jsxs as S, Fragment as re, jsx as e } from "react/jsx-runtime";
2
+ import { ListNode as ie, ListItemNode as ne } from "@lexical/list";
3
+ import { OverflowNode as se } from "@lexical/overflow";
4
+ import { CharacterLimitPlugin as ce } from "@lexical/react/LexicalCharacterLimitPlugin";
5
+ import { LexicalComposer as le } from "@lexical/react/LexicalComposer";
6
+ import { ContentEditable as me } from "@lexical/react/LexicalContentEditable";
7
+ import { EditorRefPlugin as ae } from "@lexical/react/LexicalEditorRefPlugin";
8
+ import { LexicalErrorBoundary as de } from "@lexical/react/LexicalErrorBoundary";
9
+ import { HistoryPlugin as ue } from "@lexical/react/LexicalHistoryPlugin";
10
+ import { ListPlugin as fe } from "@lexical/react/LexicalListPlugin";
11
+ import { OnChangePlugin as pe } from "@lexical/react/LexicalOnChangePlugin";
12
+ import { RichTextPlugin as he } from "@lexical/react/LexicalRichTextPlugin";
13
+ import { QuoteNode as ge } from "@lexical/rich-text";
14
+ import M from "classnames";
15
+ import { $getRoot as Se } from "lexical";
16
+ import { useState as f, useId as xe, useRef as Pe, useEffect as w } from "react";
17
+ import { useIntl as Ce } from "react-intl";
18
+ import Te from "./EditorTheme.js";
19
19
  import i from "./TextEditor.module.scss.js";
20
- import { AutoSavePlugin as Te } from "./plugins/AutoSavePlugin.js";
21
- import { FocusPlugin as Ie } from "./plugins/FocusPlugin.js";
22
- import { IOSInsertParagraphFallbackPlugin as Ne } from "./plugins/IOSInsertParagraphFallbackPlugin.js";
23
- import { MaxLengthPlugin as ve } from "./plugins/MaxLengthPlugin.js";
24
- import { ResetPlugin as Ee } from "./plugins/ResetPlugin.js";
20
+ import { AutoSavePlugin as Ie } from "./plugins/AutoSavePlugin.js";
21
+ import { FocusPlugin as Ne } from "./plugins/FocusPlugin.js";
22
+ import { IOSInsertParagraphFallbackPlugin as ve } from "./plugins/IOSInsertParagraphFallbackPlugin.js";
23
+ import { MaxLengthPlugin as Ee } from "./plugins/MaxLengthPlugin.js";
24
+ import { ResetPlugin as be } from "./plugins/ResetPlugin.js";
25
25
  import { SetContentPlugin as Re } from "./plugins/SetContentPlugin.js";
26
- import { SetRichContentPlugin as be } from "./plugins/SetRichContentPlugin.js";
27
- import { ToolbarPlugin as Me } from "./plugins/ToolbarPlugin.js";
26
+ import { SetRichContentPlugin as Me } from "./plugins/SetRichContentPlugin.js";
27
+ import { ToolbarPlugin as we } from "./plugins/ToolbarPlugin.js";
28
28
  import { useModal as ye } from "../../dialog/modal/useModal.js";
29
- import { SourceModal as we } from "../../source/source_modal/SourceModal.js";
30
- import { SourceListItem as Le } from "../../source/source_list_item/SourceListItem.js";
31
- const y = (l) => l?.replace(/&nbsp;/g, " "), lt = ({
29
+ import { SourceModal as Le } from "../../source/source_modal/SourceModal.js";
30
+ import { SourceListItem as _e } from "../../source/source_list_item/SourceListItem.js";
31
+ const y = (l) => l?.replace(/&nbsp;/g, " "), mt = ({
32
32
  placeholder: l,
33
- initialContent: w,
34
- initialRichContent: L,
33
+ initialContent: L,
34
+ initialRichContent: _,
35
35
  onSubmit: x,
36
36
  sources: p,
37
- hideSubmit: _ = !1,
38
- hideSourceAction: A = !1,
37
+ hideSubmit: A = !1,
38
+ hideSourceAction: O = !1,
39
39
  onActivation: n,
40
- disabled: O = !1,
40
+ disabled: k = !1,
41
41
  handleChange: P,
42
42
  handleSourcesChange: h,
43
- shortBar: k = !1,
43
+ shortBar: B = !1,
44
44
  active: g = !1,
45
45
  maxLength: m,
46
- disableRichText: B = !1,
47
- editorRef: U,
46
+ disableRichText: U = !1,
47
+ editorRef: j,
48
48
  uid: C,
49
49
  allowedDomains: T = [],
50
- hideCharCount: j = !1,
51
- disableAutoActivate: z = !1,
50
+ hideCharCount: z = !1,
51
+ disableAutoActivate: F = !1,
52
52
  autoFocus: a = !1,
53
- ...F
53
+ isReply: I = !1,
54
+ ...H
54
55
  }) => {
55
- const [s, H] = f(a || g), [J, Q] = f(""), [W, $] = f(""), [d, u] = f([]), { showModal: q } = ye(), I = Pe(), N = Se(), v = xe(!1);
56
- M(() => {
57
- a && !v.current && n && (v.current = !0, n());
58
- }, [a, n]), M(() => {
56
+ const [s, J] = f(a || g), [Q, W] = f(""), [$, q] = f(""), [d, u] = f([]), { showModal: D } = ye(), N = Ce(), v = xe(), E = Pe(!1);
57
+ w(() => {
58
+ a && !E.current && n && (E.current = !0, n());
59
+ }, [a, n]), w(() => {
59
60
  p && u(p);
60
61
  }, [p]);
61
- const E = () => {
62
- s || (H(!0), n && n());
63
- }, D = {
64
- editable: !O,
65
- theme: Ce,
62
+ const b = () => {
63
+ s || (J(!0), n && n());
64
+ }, G = {
65
+ editable: !k,
66
+ theme: Te,
66
67
  onError(t) {
67
68
  console.error("TextEditor error:", t);
68
69
  },
69
- nodes: [re, ie, he, ne]
70
- }, G = () => {
71
- E();
72
- }, K = (t) => {
70
+ nodes: [ie, ne, ge, se]
71
+ }, K = () => {
72
+ b();
73
+ }, V = (t) => {
73
74
  t.read(() => {
74
- const o = ge().getTextContent(), r = y(o), c = JSON.stringify(t), R = y(c);
75
- Q(r), $(R), P && P(r, R);
75
+ const o = Se().getTextContent(), r = y(o), c = JSON.stringify(t), R = y(c);
76
+ W(r), q(R), P && P(r, R);
76
77
  });
77
- }, V = (t) => {
78
- const o = J, r = W, c = d;
78
+ }, X = (t) => {
79
+ const o = Q, r = $, c = d;
79
80
  x && (t.preventDefault(), x(o, r, c)), u([]), h?.([]);
80
- }, X = () => {
81
- q(
81
+ }, Y = () => {
82
+ D(
82
83
  /* @__PURE__ */ e(
83
- we,
84
+ Le,
84
85
  {
85
- onAddSource: Y,
86
+ onAddSource: Z,
86
87
  allowedSources: T
87
88
  }
88
89
  )
89
90
  );
90
- }, Y = (t) => {
91
+ }, Z = (t) => {
91
92
  u((o) => {
92
93
  const r = [...o, t];
93
94
  return h?.(r), r;
94
95
  });
95
- }, Z = (t) => {
96
+ }, ee = (t) => {
96
97
  u((o) => {
97
98
  const r = o.filter(
98
99
  (c) => c.source_url !== t.source_url
99
100
  );
100
101
  return h?.(r), r;
101
102
  });
102
- }, ee = (t, o) => /* @__PURE__ */ e(
103
- Le,
103
+ }, te = (t, o) => /* @__PURE__ */ e(
104
+ _e,
104
105
  {
105
106
  publisher: t.publisher,
106
107
  url: t.source_url,
107
108
  title: t.title,
108
109
  index: o,
109
- onRemove: () => Z(t)
110
+ onRemove: () => ee(t)
110
111
  },
111
112
  o
112
- ), te = () => /* @__PURE__ */ e("div", { className: i.editorPlaceholder, children: l });
113
- return /* @__PURE__ */ S(oe, { children: [
114
- /* @__PURE__ */ e(ce, { initialConfig: D, children: /* @__PURE__ */ e("div", { className: i.editorContainer, onClick: G, children: /* @__PURE__ */ S(
113
+ ), oe = () => /* @__PURE__ */ e("div", { className: i.editorPlaceholder, children: l });
114
+ return /* @__PURE__ */ S(re, { children: [
115
+ /* @__PURE__ */ e(le, { initialConfig: G, children: /* @__PURE__ */ e("div", { className: i.editorContainer, onClick: K, children: /* @__PURE__ */ S(
115
116
  "div",
116
117
  {
117
- className: b(i.editorInner, {
118
+ className: M(i.editorInner, {
118
119
  [i.editorInnerInactive]: !s && !g
119
120
  }),
120
121
  children: [
121
122
  /* @__PURE__ */ e(
122
- pe,
123
+ he,
123
124
  {
124
125
  contentEditable: /* @__PURE__ */ e(
125
- le,
126
+ me,
126
127
  {
127
- className: b(i.editorInput, {
128
+ className: M(i.editorInput, {
128
129
  [i.editorInputInactive]: !s
129
130
  }),
130
- ...F
131
+ ...H
131
132
  }
132
133
  ),
133
- placeholder: l && /* @__PURE__ */ e(te, {}),
134
- ErrorBoundary: ae
134
+ placeholder: l && /* @__PURE__ */ e(oe, {}),
135
+ ErrorBoundary: de
135
136
  }
136
137
  ),
137
138
  /* @__PURE__ */ e(
138
- Me,
139
+ we,
139
140
  {
140
- hideSourceAction: A,
141
- hideSubmit: _,
142
- disableRichText: B,
143
- shortBar: k,
144
- onSubmit: V,
145
- onAddSource: X,
141
+ hideSourceAction: O,
142
+ hideSubmit: A,
143
+ disableRichText: U,
144
+ shortBar: B,
145
+ onSubmit: X,
146
+ onAddSource: Y,
146
147
  isActive: s || g,
147
- sourceTooltip: T?.length > 0 && I.formatMessage({
148
+ sourceTooltip: T?.length > 0 && N.formatMessage({
148
149
  id: "input.allowed_domains_tooltip",
149
150
  defaultMessage: "With the new source function, you can add links to your article."
150
151
  })
151
152
  }
152
153
  ),
153
- s && m && !j && /* @__PURE__ */ S("div", { className: i.charactersCount, children: [
154
- /* @__PURE__ */ e(se, { maxLength: m }),
154
+ s && m && !z && /* @__PURE__ */ S("div", { className: i.charactersCount, children: [
155
+ /* @__PURE__ */ e(ce, { maxLength: m }),
155
156
  " ",
156
- I.formatMessage({
157
+ N.formatMessage({
157
158
  id: "input.remaining_chars",
158
159
  defaultMessage: "remaining characters"
159
160
  })
160
161
  ] }),
162
+ /* @__PURE__ */ e(fe, {}),
161
163
  /* @__PURE__ */ e(ue, {}),
162
- /* @__PURE__ */ e(de, {}),
163
- /* @__PURE__ */ e(fe, { onChange: K, ignoreSelectionChange: !0 }),
164
+ /* @__PURE__ */ e(pe, { onChange: V, ignoreSelectionChange: !0 }),
164
165
  /* @__PURE__ */ e(
165
- Te,
166
+ Ie,
166
167
  {
167
- onSetContent: z ? () => {
168
- } : E,
169
- storageUid: C || N
168
+ onSetContent: F ? () => {
169
+ } : b,
170
+ storageUid: C || v
170
171
  }
171
172
  ),
172
- /* @__PURE__ */ e(Re, { content: w }),
173
- /* @__PURE__ */ e(be, { richContent: L }),
174
- /* @__PURE__ */ e(Ie, { autoFocus: a }),
175
- /* @__PURE__ */ e(Ne, {}),
176
- m && /* @__PURE__ */ e(ve, { maxLength: m }),
177
- /* @__PURE__ */ e(Ee, { storageUid: C || N }),
178
- /* @__PURE__ */ e(me, { editorRef: U })
173
+ /* @__PURE__ */ e(Re, { content: L, isReply: I }),
174
+ /* @__PURE__ */ e(Me, { richContent: _, isReply: I }),
175
+ /* @__PURE__ */ e(Ne, { autoFocus: a }),
176
+ /* @__PURE__ */ e(ve, {}),
177
+ m && /* @__PURE__ */ e(Ee, { maxLength: m }),
178
+ /* @__PURE__ */ e(be, { storageUid: C || v }),
179
+ /* @__PURE__ */ e(ae, { editorRef: j })
179
180
  ]
180
181
  }
181
182
  ) }) }),
182
- d && d.length !== 0 ? /* @__PURE__ */ e("div", { className: i.sourcesBox, children: /* @__PURE__ */ e("div", { className: i.sourceList, children: d.map(ee) }) }) : null
183
+ d && d.length !== 0 ? /* @__PURE__ */ e("div", { className: i.sourcesBox, children: /* @__PURE__ */ e("div", { className: i.sourceList, children: d.map(te) }) }) : null
183
184
  ] });
184
185
  };
185
186
  export {
186
- lt as TextEditor
187
+ mt as TextEditor
187
188
  };
@@ -1,18 +1,18 @@
1
- import { useLexicalComposerContext as s } from "@lexical/react/LexicalComposerContext";
2
- import { $getRoot as a, $createParagraphNode as c, $createTextNode as u } from "lexical";
3
- import { useEffect as f } from "react";
4
- import { useInput as m } from "../../input_provider/useInput.js";
5
- const x = ({ content: e }) => {
6
- const [p] = s(), { inputContent: o, setInputContent: i } = m(), t = e || (typeof o == "string" ? o : void 0);
7
- return f(() => {
8
- typeof t == "string" && t && p.update(() => {
9
- const n = a();
1
+ import { useLexicalComposerContext as a } from "@lexical/react/LexicalComposerContext";
2
+ import { $getRoot as c, $createParagraphNode as f, $createTextNode as u } from "lexical";
3
+ import { useEffect as m } from "react";
4
+ import { useInput as d } from "../../input_provider/useInput.js";
5
+ const $ = ({ content: e, isReply: p = !1 }) => {
6
+ const [s] = a(), { inputContent: o, setInputContent: i } = d(), t = e || (!p && typeof o == "string" ? o : void 0);
7
+ return m(() => {
8
+ typeof t == "string" && t && s.update(() => {
9
+ const n = c();
10
10
  n.clear();
11
- const r = c();
11
+ const r = f();
12
12
  r.append(u(t)), n.append(r), !e && o && i(null);
13
13
  });
14
14
  }, [t]), null;
15
15
  };
16
16
  export {
17
- x as SetContentPlugin
17
+ $ as SetContentPlugin
18
18
  };
@@ -1,15 +1,15 @@
1
- import { useLexicalComposerContext as s } from "@lexical/react/LexicalComposerContext";
2
- import { useEffect as u } from "react";
3
- import { useInput as c } from "../../input_provider/useInput.js";
4
- const m = ({ richContent: e }) => {
5
- const [t] = s(), { inputRichContent: n, setInputRichContent: i } = c(), o = e || n;
6
- return u(() => {
1
+ import { useLexicalComposerContext as u } from "@lexical/react/LexicalComposerContext";
2
+ import { useEffect as c } from "react";
3
+ import { useInput as p } from "../../input_provider/useInput.js";
4
+ const l = ({ richContent: e, isReply: i = !1 }) => {
5
+ const [t] = u(), { inputRichContent: n, setInputRichContent: r } = p(), o = e || (i ? void 0 : n);
6
+ return c(() => {
7
7
  o && t.update(() => {
8
- const r = t.parseEditorState(o);
9
- t.setEditorState(r), !e && n && i(null);
8
+ const s = t.parseEditorState(o);
9
+ t.setEditorState(s), !e && n && r(null);
10
10
  });
11
11
  }, [o]), null;
12
12
  };
13
13
  export {
14
- m as SetRichContentPlugin
14
+ l as SetRichContentPlugin
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.74",
3
+ "version": "0.4.75",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",