@logora/debate 0.3.66 → 0.3.67

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,111 +1,113 @@
1
- import { jsxs as p, Fragment as X, jsx as o } from "react/jsx-runtime";
2
- import { ListNode as Y, ListItemNode as Z } from "@lexical/list";
3
- import { OverflowNode as oo } from "@lexical/overflow";
4
- import { CharacterLimitPlugin as to } from "@lexical/react/LexicalCharacterLimitPlugin";
5
- import { LexicalComposer as eo } from "@lexical/react/LexicalComposer";
6
- import { ContentEditable as ro } from "@lexical/react/LexicalContentEditable";
7
- import { EditorRefPlugin as io } from "@lexical/react/LexicalEditorRefPlugin";
8
- import { LexicalErrorBoundary as no } from "@lexical/react/LexicalErrorBoundary";
9
- import { HistoryPlugin as so } from "@lexical/react/LexicalHistoryPlugin";
10
- import { ListPlugin as co } from "@lexical/react/LexicalListPlugin";
11
- import { OnChangePlugin as lo } from "@lexical/react/LexicalOnChangePlugin";
12
- import { RichTextPlugin as mo } from "@lexical/react/LexicalRichTextPlugin";
13
- import { QuoteNode as ao } from "@lexical/rich-text";
1
+ import { jsxs as p, Fragment as Z, jsx as o } from "react/jsx-runtime";
2
+ import { ListNode as oo, ListItemNode as to } from "@lexical/list";
3
+ import { OverflowNode as eo } from "@lexical/overflow";
4
+ import { CharacterLimitPlugin as ro } from "@lexical/react/LexicalCharacterLimitPlugin";
5
+ import { LexicalComposer as io } from "@lexical/react/LexicalComposer";
6
+ import { ContentEditable as no } from "@lexical/react/LexicalContentEditable";
7
+ import { EditorRefPlugin as so } from "@lexical/react/LexicalEditorRefPlugin";
8
+ import { LexicalErrorBoundary as co } from "@lexical/react/LexicalErrorBoundary";
9
+ import { HistoryPlugin as lo } from "@lexical/react/LexicalHistoryPlugin";
10
+ import { ListPlugin as mo } from "@lexical/react/LexicalListPlugin";
11
+ import { OnChangePlugin as ao } from "@lexical/react/LexicalOnChangePlugin";
12
+ import { RichTextPlugin as uo } from "@lexical/react/LexicalRichTextPlugin";
13
+ import { QuoteNode as fo } from "@lexical/rich-text";
14
14
  import I from "classnames";
15
- import { $getRoot as uo } from "lexical";
16
- import { useState as d, useId as fo, useEffect as po } from "react";
17
- import { useIntl as ho } from "react-intl";
18
- import go from "./EditorTheme.js";
15
+ import { $getRoot as po } from "lexical";
16
+ import { useState as d, useId as ho, useEffect as go } from "react";
17
+ import { useIntl as So } from "react-intl";
18
+ import xo from "./EditorTheme.js";
19
19
  import i from "./TextEditor.module.scss.js";
20
- import { AutoSavePlugin as So } from "./plugins/AutoSavePlugin.js";
21
- import { FocusPlugin as xo } from "./plugins/FocusPlugin.js";
22
- import { MaxLengthPlugin as vo } from "./plugins/MaxLengthPlugin.js";
23
- import { ResetPlugin as Po } from "./plugins/ResetPlugin.js";
24
- import { SetContentPlugin as Co } from "./plugins/SetContentPlugin.js";
25
- import { SetRichContentPlugin as To } from "./plugins/SetRichContentPlugin.js";
26
- import { ToolbarPlugin as No } from "./plugins/ToolbarPlugin.js";
27
- import { useModal as Eo } from "../../dialog/modal/useModal.js";
28
- import { SourceModal as Io } from "../../source/source_modal/SourceModal.js";
29
- import { SourceListItem as Ro } from "../../source/source_list_item/SourceListItem.js";
30
- const R = (c) => c?.replace(/ /g, " "), et = ({
20
+ import { AutoSavePlugin as vo } from "./plugins/AutoSavePlugin.js";
21
+ import { FocusPlugin as Co } from "./plugins/FocusPlugin.js";
22
+ import { MaxLengthPlugin as Po } from "./plugins/MaxLengthPlugin.js";
23
+ import { ResetPlugin as To } from "./plugins/ResetPlugin.js";
24
+ import { SetContentPlugin as No } from "./plugins/SetContentPlugin.js";
25
+ import { SetRichContentPlugin as Eo } from "./plugins/SetRichContentPlugin.js";
26
+ import { ToolbarPlugin as Io } from "./plugins/ToolbarPlugin.js";
27
+ import { useModal as Ro } from "../../dialog/modal/useModal.js";
28
+ import { SourceModal as bo } from "../../source/source_modal/SourceModal.js";
29
+ import { SourceListItem as Mo } from "../../source/source_list_item/SourceListItem.js";
30
+ const R = (c) => c?.replace(/ /g, " "), it = ({
31
31
  placeholder: c,
32
+ initialContent: b,
33
+ initialRichContent: M,
32
34
  onSubmit: h,
33
35
  sources: u,
34
- hideSubmit: b = !1,
35
- hideSourceAction: M = !1,
36
+ hideSubmit: y = !1,
37
+ hideSourceAction: w = !1,
36
38
  onActivation: g,
37
- disabled: y = !1,
39
+ disabled: A = !1,
38
40
  handleChange: S,
39
41
  handleSourcesChange: f,
40
- shortBar: w = !1,
42
+ shortBar: L = !1,
41
43
  active: x = !1,
42
44
  maxLength: l,
43
- disableRichText: A = !1,
44
- editorRef: L,
45
+ disableRichText: _ = !1,
46
+ editorRef: B,
45
47
  uid: v,
46
- allowedDomains: P = [],
47
- hideCharCount: _ = !1,
48
- disableAutoActivate: B = !1,
49
- ...F
48
+ allowedDomains: C = [],
49
+ hideCharCount: F = !1,
50
+ disableAutoActivate: O = !1,
51
+ ...U
50
52
  }) => {
51
- const [n, O] = d(!1), [U, j] = d(""), [k, z] = d(""), [m, a] = d([]), { showModal: H } = Eo(), C = ho(), T = fo();
52
- po(() => {
53
+ const [n, j] = d(!1), [k, z] = d(""), [H, J] = d(""), [m, a] = d([]), { showModal: Q } = Ro(), P = So(), T = ho();
54
+ go(() => {
53
55
  u && a(u);
54
56
  }, [u]);
55
57
  const N = () => {
56
- n || (O(!0), g && g());
57
- }, J = {
58
- editable: !y,
59
- theme: go,
58
+ n || (j(!0), g && g());
59
+ }, W = {
60
+ editable: !A,
61
+ theme: xo,
60
62
  onError(t) {
61
63
  console.error("TextEditor error:", t);
62
64
  },
63
- nodes: [Y, Z, ao, oo]
64
- }, Q = () => {
65
+ nodes: [oo, to, fo, eo]
66
+ }, $ = () => {
65
67
  N();
66
- }, W = (t) => {
68
+ }, q = (t) => {
67
69
  t.read(() => {
68
- const e = uo().getTextContent(), r = R(e), s = JSON.stringify(t), E = R(s);
69
- j(r), z(E), S && S(r, E);
70
+ const e = po().getTextContent(), r = R(e), s = JSON.stringify(t), E = R(s);
71
+ z(r), J(E), S && S(r, E);
70
72
  });
71
- }, $ = (t) => {
72
- const e = U, r = k, s = m;
73
+ }, D = (t) => {
74
+ const e = k, r = H, s = m;
73
75
  h && (t.preventDefault(), h(e, r, s)), a([]), f?.([]);
74
- }, q = () => {
75
- H(
76
+ }, G = () => {
77
+ Q(
76
78
  /* @__PURE__ */ o(
77
- Io,
79
+ bo,
78
80
  {
79
- onAddSource: D,
80
- allowedSources: P
81
+ onAddSource: K,
82
+ allowedSources: C
81
83
  }
82
84
  )
83
85
  );
84
- }, D = (t) => {
86
+ }, K = (t) => {
85
87
  a((e) => {
86
88
  const r = [...e, t];
87
89
  return f?.(r), r;
88
90
  });
89
- }, G = (t) => {
91
+ }, V = (t) => {
90
92
  a((e) => {
91
93
  const r = e.filter(
92
94
  (s) => s.source_url !== t.source_url
93
95
  );
94
96
  return f?.(r), r;
95
97
  });
96
- }, K = (t, e) => /* @__PURE__ */ o(
97
- Ro,
98
+ }, X = (t, e) => /* @__PURE__ */ o(
99
+ Mo,
98
100
  {
99
101
  publisher: t.publisher,
100
102
  url: t.source_url,
101
103
  title: t.title,
102
104
  index: e,
103
- onRemove: () => G(t)
105
+ onRemove: () => V(t)
104
106
  },
105
107
  e
106
- ), V = () => /* @__PURE__ */ o("div", { className: i.editorPlaceholder, children: c });
107
- return /* @__PURE__ */ p(X, { children: [
108
- /* @__PURE__ */ o(eo, { initialConfig: J, children: /* @__PURE__ */ o("div", { className: i.editorContainer, onClick: Q, children: /* @__PURE__ */ p(
108
+ ), Y = () => /* @__PURE__ */ o("div", { className: i.editorPlaceholder, children: c });
109
+ return /* @__PURE__ */ p(Z, { children: [
110
+ /* @__PURE__ */ o(io, { initialConfig: W, children: /* @__PURE__ */ o("div", { className: i.editorContainer, onClick: $, children: /* @__PURE__ */ p(
109
111
  "div",
110
112
  {
111
113
  className: I(i.editorInner, {
@@ -113,68 +115,68 @@ const R = (c) => c?.replace(/ /g, " "), et = ({
113
115
  }),
114
116
  children: [
115
117
  /* @__PURE__ */ o(
116
- mo,
118
+ uo,
117
119
  {
118
120
  contentEditable: /* @__PURE__ */ o(
119
- ro,
121
+ no,
120
122
  {
121
123
  className: I(i.editorInput, {
122
124
  [i.editorInputInactive]: !n
123
125
  }),
124
- ...F
126
+ ...U
125
127
  }
126
128
  ),
127
- placeholder: c && /* @__PURE__ */ o(V, {}),
128
- ErrorBoundary: no
129
+ placeholder: c && /* @__PURE__ */ o(Y, {}),
130
+ ErrorBoundary: co
129
131
  }
130
132
  ),
131
133
  /* @__PURE__ */ o(
132
- No,
134
+ Io,
133
135
  {
134
- hideSourceAction: M,
135
- hideSubmit: b,
136
- disableRichText: A,
137
- shortBar: w,
138
- onSubmit: $,
139
- onAddSource: q,
136
+ hideSourceAction: w,
137
+ hideSubmit: y,
138
+ disableRichText: _,
139
+ shortBar: L,
140
+ onSubmit: D,
141
+ onAddSource: G,
140
142
  isActive: n || x,
141
- sourceTooltip: P?.length > 0 && C.formatMessage({
143
+ sourceTooltip: C?.length > 0 && P.formatMessage({
142
144
  id: "input.allowed_domains_tooltip",
143
145
  defaultMessage: "With the new source function, you can add links to your article."
144
146
  })
145
147
  }
146
148
  ),
147
- n && l && !_ && /* @__PURE__ */ p("div", { className: i.charactersCount, children: [
148
- /* @__PURE__ */ o(to, { maxLength: l }),
149
+ n && l && !F && /* @__PURE__ */ p("div", { className: i.charactersCount, children: [
150
+ /* @__PURE__ */ o(ro, { maxLength: l }),
149
151
  " ",
150
- C.formatMessage({
152
+ P.formatMessage({
151
153
  id: "input.remaining_chars",
152
154
  defaultMessage: "remaining characters"
153
155
  })
154
156
  ] }),
155
- /* @__PURE__ */ o(co, {}),
156
- /* @__PURE__ */ o(so, {}),
157
- /* @__PURE__ */ o(lo, { onChange: W, ignoreSelectionChange: !0 }),
157
+ /* @__PURE__ */ o(mo, {}),
158
+ /* @__PURE__ */ o(lo, {}),
159
+ /* @__PURE__ */ o(ao, { onChange: q, ignoreSelectionChange: !0 }),
158
160
  /* @__PURE__ */ o(
159
- So,
161
+ vo,
160
162
  {
161
- onSetContent: B ? () => {
163
+ onSetContent: O ? () => {
162
164
  } : N,
163
165
  storageUid: v || T
164
166
  }
165
167
  ),
168
+ /* @__PURE__ */ o(No, { content: b }),
169
+ /* @__PURE__ */ o(Eo, { richContent: M }),
166
170
  /* @__PURE__ */ o(Co, {}),
167
- /* @__PURE__ */ o(To, {}),
168
- /* @__PURE__ */ o(xo, {}),
169
- l && /* @__PURE__ */ o(vo, { maxLength: l }),
170
- /* @__PURE__ */ o(Po, { storageUid: v || T }),
171
- /* @__PURE__ */ o(io, { editorRef: L })
171
+ l && /* @__PURE__ */ o(Po, { maxLength: l }),
172
+ /* @__PURE__ */ o(To, { storageUid: v || T }),
173
+ /* @__PURE__ */ o(so, { editorRef: B })
172
174
  ]
173
175
  }
174
176
  ) }) }),
175
- m && m.length !== 0 ? /* @__PURE__ */ o("div", { className: i.sourcesBox, children: /* @__PURE__ */ o("div", { className: i.sourceList, children: m.map(K) }) }) : null
177
+ m && m.length !== 0 ? /* @__PURE__ */ o("div", { className: i.sourcesBox, children: /* @__PURE__ */ o("div", { className: i.sourceList, children: m.map(X) }) }) : null
176
178
  ] });
177
179
  };
178
180
  export {
179
- et as TextEditor
181
+ it as TextEditor
180
182
  };
@@ -1,18 +1,18 @@
1
- import { useLexicalComposerContext as p } from "@lexical/react/LexicalComposerContext";
2
- import { $getRoot as u, $createParagraphNode as a, $createTextNode as c } from "lexical";
3
- import { useEffect as s } from "react";
4
- import { useInput as i } from "../../input_provider/useInput.js";
5
- const C = () => {
6
- const [n] = p(), { inputContent: t, setInputContent: r } = i();
7
- return s(() => {
8
- t && n.update(() => {
9
- const e = u();
10
- e.clear();
11
- const o = a();
12
- o.append(c(t)), e.append(o), r(null);
1
+ import { useLexicalComposerContext as a } from "@lexical/react/LexicalComposerContext";
2
+ import { $getRoot as c, $createParagraphNode as i, $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: o }) => {
6
+ const [p] = a(), { inputContent: e, setInputContent: s } = m(), t = o || e;
7
+ return f(() => {
8
+ typeof t == "string" && t && p.update(() => {
9
+ const n = c();
10
+ n.clear();
11
+ const r = i();
12
+ r.append(u(t)), n.append(r), !o && e && s(null);
13
13
  });
14
14
  }, [t]), null;
15
15
  };
16
16
  export {
17
- C as SetContentPlugin
17
+ x as SetContentPlugin
18
18
  };
@@ -1,14 +1,14 @@
1
- import { useLexicalComposerContext as r } from "@lexical/react/LexicalComposerContext";
2
- import { useEffect as i } from "react";
3
- import { useInput as s } from "../../input_provider/useInput.js";
4
- const m = () => {
5
- const [t] = r(), { inputRichContent: e, setInputRichContent: o } = s();
6
- return i(() => {
7
- e && t.update(() => {
8
- const n = t.parseEditorState(e);
9
- t.setEditorState(n), o(null);
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(() => {
7
+ o && t.update(() => {
8
+ const r = t.parseEditorState(o);
9
+ t.setEditorState(r), !e && n && i(null);
10
10
  });
11
- }, [e]), null;
11
+ }, [o]), null;
12
12
  };
13
13
  export {
14
14
  m as SetRichContentPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.66",
3
+ "version": "0.3.67",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",