@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
|
|
2
|
-
import { ListNode as
|
|
3
|
-
import { OverflowNode as
|
|
4
|
-
import { CharacterLimitPlugin as
|
|
5
|
-
import { LexicalComposer as
|
|
6
|
-
import { ContentEditable as
|
|
7
|
-
import { EditorRefPlugin as
|
|
8
|
-
import { LexicalErrorBoundary as
|
|
9
|
-
import { HistoryPlugin as
|
|
10
|
-
import { ListPlugin as
|
|
11
|
-
import { OnChangePlugin as
|
|
12
|
-
import { RichTextPlugin as
|
|
13
|
-
import { QuoteNode as
|
|
14
|
-
import
|
|
15
|
-
import { $getRoot as
|
|
16
|
-
import { useState as d, useId as
|
|
17
|
-
import { useIntl as
|
|
18
|
-
import
|
|
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
|
|
21
|
-
import { FocusPlugin as
|
|
22
|
-
import { MaxLengthPlugin as
|
|
23
|
-
import { ResetPlugin as
|
|
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
|
|
26
|
-
import { ToolbarPlugin as
|
|
27
|
-
import { useModal as
|
|
28
|
-
import { SourceModal as
|
|
29
|
-
import { SourceListItem as
|
|
30
|
-
const
|
|
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:
|
|
35
|
-
hideSourceAction:
|
|
34
|
+
hideSubmit: M = !1,
|
|
35
|
+
hideSourceAction: y = !1,
|
|
36
36
|
onActivation: g,
|
|
37
|
-
disabled:
|
|
37
|
+
disabled: w = !1,
|
|
38
38
|
handleChange: S,
|
|
39
39
|
handleSourcesChange: f,
|
|
40
|
-
shortBar:
|
|
40
|
+
shortBar: A = !1,
|
|
41
41
|
active: x = !1,
|
|
42
42
|
maxLength: l,
|
|
43
|
-
disableRichText:
|
|
44
|
-
editorRef:
|
|
43
|
+
disableRichText: L = !1,
|
|
44
|
+
editorRef: _,
|
|
45
45
|
uid: v,
|
|
46
46
|
allowedDomains: P = [],
|
|
47
|
-
hideCharCount:
|
|
48
|
-
disableAutoActivate:
|
|
49
|
-
|
|
47
|
+
hideCharCount: B = !1,
|
|
48
|
+
disableAutoActivate: F = !1,
|
|
49
|
+
initialContent: T,
|
|
50
|
+
...O
|
|
50
51
|
}) => {
|
|
51
|
-
const [n,
|
|
52
|
-
|
|
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
|
|
56
|
-
n || (
|
|
57
|
-
},
|
|
58
|
-
editable: !
|
|
59
|
-
theme:
|
|
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: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
nodes: [Z, oo, uo, to],
|
|
65
|
+
...T ? { editorState: T } : {}
|
|
66
|
+
}, W = () => {
|
|
67
|
+
E();
|
|
68
|
+
}, $ = (t) => {
|
|
67
69
|
t.read(() => {
|
|
68
|
-
const e =
|
|
69
|
-
|
|
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
|
-
},
|
|
72
|
-
const e =
|
|
73
|
+
}, q = (t) => {
|
|
74
|
+
const e = j, r = z, s = m;
|
|
73
75
|
h && (t.preventDefault(), h(e, r, s)), a([]), f?.([]);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
+
}, D = () => {
|
|
77
|
+
J(
|
|
76
78
|
/* @__PURE__ */ o(
|
|
77
|
-
|
|
79
|
+
Ro,
|
|
78
80
|
{
|
|
79
|
-
onAddSource:
|
|
81
|
+
onAddSource: G,
|
|
80
82
|
allowedSources: P
|
|
81
83
|
}
|
|
82
84
|
)
|
|
83
85
|
);
|
|
84
|
-
},
|
|
86
|
+
}, G = (t) => {
|
|
85
87
|
a((e) => {
|
|
86
88
|
const r = [...e, t];
|
|
87
89
|
return f?.(r), r;
|
|
88
90
|
});
|
|
89
|
-
},
|
|
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
|
-
},
|
|
97
|
-
|
|
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: () =>
|
|
105
|
+
onRemove: () => K(t)
|
|
104
106
|
},
|
|
105
107
|
e
|
|
106
|
-
),
|
|
107
|
-
return /* @__PURE__ */ p(
|
|
108
|
-
/* @__PURE__ */ o(
|
|
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:
|
|
113
|
+
className: R(i.editorInner, {
|
|
112
114
|
[i.editorInnerInactive]: !n && !x
|
|
113
115
|
}),
|
|
114
116
|
children: [
|
|
115
117
|
/* @__PURE__ */ o(
|
|
116
|
-
|
|
118
|
+
ao,
|
|
117
119
|
{
|
|
118
120
|
contentEditable: /* @__PURE__ */ o(
|
|
119
|
-
|
|
121
|
+
io,
|
|
120
122
|
{
|
|
121
|
-
className:
|
|
123
|
+
className: R(i.editorInput, {
|
|
122
124
|
[i.editorInputInactive]: !n
|
|
123
125
|
}),
|
|
124
|
-
...
|
|
126
|
+
...O
|
|
125
127
|
}
|
|
126
128
|
),
|
|
127
|
-
placeholder: c && /* @__PURE__ */ o(
|
|
128
|
-
ErrorBoundary:
|
|
129
|
+
placeholder: c && /* @__PURE__ */ o(X, {}),
|
|
130
|
+
ErrorBoundary: so
|
|
129
131
|
}
|
|
130
132
|
),
|
|
131
133
|
/* @__PURE__ */ o(
|
|
132
|
-
|
|
134
|
+
Eo,
|
|
133
135
|
{
|
|
134
|
-
hideSourceAction:
|
|
135
|
-
hideSubmit:
|
|
136
|
-
disableRichText:
|
|
137
|
-
shortBar:
|
|
138
|
-
onSubmit:
|
|
139
|
-
onAddSource:
|
|
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 && !
|
|
148
|
-
/* @__PURE__ */ o(
|
|
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(
|
|
157
|
-
/* @__PURE__ */ o(lo, { onChange: W, ignoreSelectionChange: !0 }),
|
|
159
|
+
/* @__PURE__ */ o(mo, { onChange: $, ignoreSelectionChange: !0 }),
|
|
158
160
|
/* @__PURE__ */ o(
|
|
159
|
-
|
|
161
|
+
xo,
|
|
160
162
|
{
|
|
161
|
-
onSetContent:
|
|
162
|
-
} :
|
|
163
|
-
storageUid: v ||
|
|
163
|
+
onSetContent: F ? () => {
|
|
164
|
+
} : E,
|
|
165
|
+
storageUid: v || N
|
|
164
166
|
}
|
|
165
167
|
),
|
|
166
168
|
/* @__PURE__ */ o(Co, {}),
|
|
167
|
-
/* @__PURE__ */ o(
|
|
168
|
-
/* @__PURE__ */ o(
|
|
169
|
-
l && /* @__PURE__ */ o(
|
|
170
|
-
/* @__PURE__ */ o(
|
|
171
|
-
/* @__PURE__ */ o(
|
|
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(
|
|
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
|
-
|
|
181
|
+
rt as TextEditor
|
|
180
182
|
};
|