@logora/debate 0.3.64 → 0.3.65

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