@logora/debate 0.3.108 → 0.3.110
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,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
const
|
|
4
|
-
/* @__PURE__ */ e("rect", { width: "34", height: "35", rx: "17", fill: "white" }),
|
|
5
|
-
/* @__PURE__ */ e("rect", { width: "34", height: "35", rx: "17", fill: "#D70026" }),
|
|
6
|
-
/* @__PURE__ */ e("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22.923 11.3652L9.0284 16.537L13.6573 19.295L17.739 15.0921C17.946 14.8791 18.2268 14.7595 18.5195 14.7596C18.8122 14.7598 19.0929 14.8796 19.2998 15.0927C19.5067 15.3058 19.6229 15.5949 19.6228 15.8962C19.6227 16.1975 19.5063 16.4864 19.2993 16.6994L15.2165 20.9022L17.8979 25.6662L22.923 11.3652ZM23.2794 8.81629C24.598 8.32445 25.8758 9.63982 25.398 10.9972L19.5696 27.587C19.0907 28.9478 17.2855 29.1137 16.5804 27.8608L13.0306 21.5474L6.89765 17.8933C5.68055 17.1674 5.84165 15.3091 7.16358 14.8161L23.2794 8.81629Z", fill: "white" })
|
|
7
|
-
] });
|
|
3
|
+
const L = (l) => /* @__PURE__ */ e("svg", { ...l, viewBox: "0 0 34 35", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22.923 11.3652L9.0284 16.537L13.6573 19.295L17.739 15.0921C17.946 14.8791 18.2268 14.7595 18.5195 14.7596C18.8122 14.7598 19.0929 14.8796 19.2998 15.0927C19.5067 15.3058 19.6229 15.5949 19.6228 15.8962C19.6227 16.1975 19.5063 16.4864 19.2993 16.6994L15.2165 20.9022L17.8979 25.6662L22.923 11.3652ZM23.2794 8.81629C24.598 8.32445 25.8758 9.63982 25.398 10.9972L19.5696 27.587C19.0907 28.9478 17.2855 29.1137 16.5804 27.8608L13.0306 21.5474L6.89765 17.8933C5.68055 17.1674 5.84165 15.3091 7.16358 14.8161L23.2794 8.81629Z", fill: "currentColor" }) });
|
|
8
4
|
export {
|
|
9
|
-
|
|
5
|
+
L as Send
|
|
10
6
|
};
|
|
@@ -1,86 +1,96 @@
|
|
|
1
1
|
import { jsxs as y, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { $isListNode as
|
|
3
|
-
import { useLexicalComposerContext as
|
|
4
|
-
import { $isHeadingNode as
|
|
2
|
+
import { $isListNode as q, ListNode as $, 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 k } from "@lexical/rich-text";
|
|
5
5
|
import { $setBlocksType as C } from "@lexical/selection";
|
|
6
|
-
import { $getNearestNodeOfType as
|
|
6
|
+
import { $getNearestNodeOfType as j, mergeRegister as H } from "@lexical/utils";
|
|
7
7
|
import a from "classnames";
|
|
8
|
-
import { $getSelection as
|
|
9
|
-
import { useRef as
|
|
10
|
-
import { useIntl as
|
|
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 u, useCallback as z, useEffect as J } from "react";
|
|
10
|
+
import { useIntl as W } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
12
|
import { Icon as r } from "../../../icons/icon/Icon.js";
|
|
13
|
-
import { Button as
|
|
14
|
-
const
|
|
15
|
-
const s =
|
|
16
|
-
const t =
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
_(
|
|
13
|
+
import { Button as Y } from "../../../action/button/Button.js";
|
|
14
|
+
const ge = (i) => {
|
|
15
|
+
const s = W(), x = 1, [l] = U(), E = X(null), [b, _] = u("paragraph"), [Z, I] = u(null), [A, S] = u(!1), [v, w] = u(!1), [L, D] = u(!1), T = i.hideSubmit && i.hideSourceAction && i.disableRichText, g = z(() => {
|
|
16
|
+
const t = N();
|
|
17
|
+
if (M(t)) {
|
|
18
|
+
const c = t.anchor.getNode(), n = c.getKey() === "root" ? c : c.getTopLevelElementOrThrow(), m = n.getKey();
|
|
19
|
+
if (l.getElementByKey(m) !== null)
|
|
20
|
+
if (I(m), q(n)) {
|
|
21
|
+
const f = j(c, $), B = f ? f.getTag() : n.getTag();
|
|
22
|
+
_(B);
|
|
23
23
|
} else {
|
|
24
|
-
const
|
|
25
|
-
_(
|
|
24
|
+
const f = P(n) ? n.getTag() : n.getType();
|
|
25
|
+
_(f);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
S(t.hasFormat("bold")), w(t.hasFormat("italic")), D(t.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
}, [l]);
|
|
30
|
+
J(() => H(
|
|
31
|
+
l.registerUpdateListener(({ editorState: t }) => {
|
|
32
32
|
t.read(() => {
|
|
33
|
-
|
|
33
|
+
g();
|
|
34
34
|
});
|
|
35
35
|
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
(t,
|
|
39
|
-
|
|
36
|
+
l.registerCommand(
|
|
37
|
+
Q,
|
|
38
|
+
(t, c) => (g(), !1),
|
|
39
|
+
x
|
|
40
40
|
)
|
|
41
|
-
), [
|
|
42
|
-
const
|
|
41
|
+
), [l, g]);
|
|
42
|
+
const d = (t) => {
|
|
43
43
|
t.preventDefault();
|
|
44
|
-
},
|
|
45
|
-
|
|
44
|
+
}, h = () => {
|
|
45
|
+
queueMicrotask(() => {
|
|
46
|
+
requestAnimationFrame(() => {
|
|
47
|
+
l.getEditorState().read(() => {
|
|
48
|
+
g();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}, p = (t) => {
|
|
53
|
+
l.dispatchCommand(G, t), h();
|
|
46
54
|
}, O = () => {
|
|
47
|
-
b !== "
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
b !== "ol" ? l.dispatchCommand(K) : l.dispatchCommand(F), h();
|
|
56
|
+
}, R = () => {
|
|
57
|
+
b !== "quote" ? l.update(() => {
|
|
58
|
+
const t = N();
|
|
59
|
+
if (M(t))
|
|
50
60
|
if (t.isCollapsed()) {
|
|
51
|
-
const n = t.anchor.getNode().getTopLevelElementOrThrow(), m =
|
|
61
|
+
const n = t.anchor.getNode().getTopLevelElementOrThrow(), m = k();
|
|
52
62
|
n.insertAfter(m), m.selectEnd();
|
|
53
63
|
} else
|
|
54
|
-
C(t, () =>
|
|
55
|
-
}) :
|
|
56
|
-
const t =
|
|
57
|
-
|
|
58
|
-
});
|
|
64
|
+
C(t, () => k());
|
|
65
|
+
}) : l.update(() => {
|
|
66
|
+
const t = N();
|
|
67
|
+
M(t) && C(t, () => V());
|
|
68
|
+
}), h();
|
|
59
69
|
};
|
|
60
|
-
return
|
|
70
|
+
return T ? null : /* @__PURE__ */ y(
|
|
61
71
|
"div",
|
|
62
72
|
{
|
|
63
73
|
className: a(e.toolbar, {
|
|
64
|
-
[e.toolbarIsActive]:
|
|
74
|
+
[e.toolbarIsActive]: T ? !1 : i.isActive
|
|
65
75
|
}),
|
|
66
|
-
ref:
|
|
76
|
+
ref: E,
|
|
67
77
|
children: [
|
|
68
|
-
|
|
78
|
+
i.isActive ? !i.disableRichText && /* @__PURE__ */ y(
|
|
69
79
|
"div",
|
|
70
80
|
{
|
|
71
81
|
className: a(e.iconToolbar, {
|
|
72
|
-
[e.shortBar]:
|
|
82
|
+
[e.shortBar]: i.shortBar
|
|
73
83
|
}),
|
|
74
84
|
children: [
|
|
75
85
|
/* @__PURE__ */ o(
|
|
76
86
|
"button",
|
|
77
87
|
{
|
|
78
|
-
onMouseDown:
|
|
88
|
+
onMouseDown: d,
|
|
79
89
|
onClick: () => {
|
|
80
|
-
|
|
90
|
+
p("bold");
|
|
81
91
|
},
|
|
82
92
|
type: "button",
|
|
83
|
-
className: a(e.toolbarItem, { [e.active]:
|
|
93
|
+
className: a(e.toolbarItem, { [e.active]: A }),
|
|
84
94
|
"data-testid": "format-bold",
|
|
85
95
|
"aria-label": s.formatMessage({
|
|
86
96
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
@@ -100,13 +110,13 @@ const ue = (l) => {
|
|
|
100
110
|
/* @__PURE__ */ o(
|
|
101
111
|
"button",
|
|
102
112
|
{
|
|
103
|
-
onMouseDown:
|
|
113
|
+
onMouseDown: d,
|
|
104
114
|
onClick: () => {
|
|
105
|
-
|
|
115
|
+
p("italic");
|
|
106
116
|
},
|
|
107
117
|
type: "button",
|
|
108
118
|
className: a(e.toolbarItem, {
|
|
109
|
-
[e.active]:
|
|
119
|
+
[e.active]: v
|
|
110
120
|
}),
|
|
111
121
|
"aria-label": s.formatMessage({
|
|
112
122
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
@@ -126,13 +136,13 @@ const ue = (l) => {
|
|
|
126
136
|
/* @__PURE__ */ o(
|
|
127
137
|
"button",
|
|
128
138
|
{
|
|
129
|
-
onMouseDown:
|
|
139
|
+
onMouseDown: d,
|
|
130
140
|
onClick: () => {
|
|
131
|
-
|
|
141
|
+
p("underline");
|
|
132
142
|
},
|
|
133
143
|
type: "button",
|
|
134
144
|
className: a(e.toolbarItem, {
|
|
135
|
-
[e.active]:
|
|
145
|
+
[e.active]: L
|
|
136
146
|
}),
|
|
137
147
|
"aria-label": s.formatMessage({
|
|
138
148
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
@@ -152,8 +162,8 @@ const ue = (l) => {
|
|
|
152
162
|
/* @__PURE__ */ o(
|
|
153
163
|
"button",
|
|
154
164
|
{
|
|
155
|
-
onMouseDown:
|
|
156
|
-
onClick: () =>
|
|
165
|
+
onMouseDown: d,
|
|
166
|
+
onClick: () => R(),
|
|
157
167
|
type: "button",
|
|
158
168
|
className: a(e.toolbarItem, { [e.active]: b === "quote" }),
|
|
159
169
|
"aria-label": s.formatMessage({
|
|
@@ -174,8 +184,8 @@ const ue = (l) => {
|
|
|
174
184
|
/* @__PURE__ */ o(
|
|
175
185
|
"button",
|
|
176
186
|
{
|
|
177
|
-
onMouseDown:
|
|
178
|
-
onClick: () =>
|
|
187
|
+
onMouseDown: d,
|
|
188
|
+
onClick: () => O(),
|
|
179
189
|
type: "button",
|
|
180
190
|
className: a(e.toolbarItem, { [e.active]: b === "ol" }),
|
|
181
191
|
"aria-label": s.formatMessage({
|
|
@@ -193,10 +203,10 @@ const ue = (l) => {
|
|
|
193
203
|
)
|
|
194
204
|
}
|
|
195
205
|
),
|
|
196
|
-
!
|
|
206
|
+
!i.hideSourceAction && /* @__PURE__ */ o(
|
|
197
207
|
"button",
|
|
198
208
|
{
|
|
199
|
-
onClick:
|
|
209
|
+
onClick: i.onAddSource,
|
|
200
210
|
type: "button",
|
|
201
211
|
className: e.toolbarItem,
|
|
202
212
|
"aria-label": s.formatMessage({
|
|
@@ -217,12 +227,12 @@ const ue = (l) => {
|
|
|
217
227
|
]
|
|
218
228
|
}
|
|
219
229
|
) : null,
|
|
220
|
-
/* @__PURE__ */ o("div", { className: e.actionButton, children:
|
|
221
|
-
|
|
230
|
+
/* @__PURE__ */ o("div", { className: e.actionButton, children: i.hideSubmit ? null : /* @__PURE__ */ o(
|
|
231
|
+
Y,
|
|
222
232
|
{
|
|
223
233
|
type: "button",
|
|
224
234
|
"data-testid": "submit-button",
|
|
225
|
-
handleClick:
|
|
235
|
+
handleClick: i.onSubmit,
|
|
226
236
|
className: a(e.inputSubmitActionButton, e.submitAction),
|
|
227
237
|
"aria-label": s.formatMessage({
|
|
228
238
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
@@ -236,5 +246,5 @@ const ue = (l) => {
|
|
|
236
246
|
);
|
|
237
247
|
};
|
|
238
248
|
export {
|
|
239
|
-
|
|
249
|
+
ge as ToolbarPlugin
|
|
240
250
|
};
|