@logora/debate 0.4.19 → 0.4.21
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.
- package/dist/assets/components/input/text_editor/plugins/ToolbarPlugin.module-C3yG2biv.css +1 -0
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.js +89 -103
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.module.scss.js +19 -19
- package/package.json +1 -1
- package/dist/assets/components/input/text_editor/plugins/ToolbarPlugin.module-CbPmMciY.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._toolbar_awaxp_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_awaxp_3._toolbarIsActive_awaxp_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_awaxp_17{display:flex!important;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_awaxp_17._shortBar_awaxp_21{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}._toolbarItem_awaxp_25{border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle;touch-action:manipulation;display:flex;align-items:center;justify-content:center}@container (max-width: 575.98px){._toolbarItem_awaxp_25{min-width:44px;min-height:44px}}._toolbarItem_awaxp_25._disabled_awaxp_42{cursor:not-allowed}._toolbarItem_awaxp_25._active_awaxp_45{background-color:#bababa66;border-radius:50%}._toolbarItem_awaxp_25 ._format_awaxp_49{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_awaxp_56{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_awaxp_62{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_awaxp_62._submitAction_awaxp_70 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_awaxp_62 ._inputSourceText_awaxp_73{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_awaxp_62 ._inputSourceText_awaxp_73{display:block!important}}._tooltip_awaxp_84{width:230px!important;margin-left:-117px!important}
|
|
@@ -1,105 +1,101 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { $isListNode as
|
|
3
|
-
import { useLexicalComposerContext as
|
|
4
|
-
import { $isHeadingNode as
|
|
5
|
-
import { $setBlocksType as
|
|
6
|
-
import { $getNearestNodeOfType as
|
|
7
|
-
import
|
|
8
|
-
import { $getSelection as
|
|
9
|
-
import { useRef as
|
|
10
|
-
import { useIntl as
|
|
1
|
+
import { jsxs as T, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { $isListNode as D, ListNode as $, INSERT_ORDERED_LIST_COMMAND as q, REMOVE_LIST_COMMAND as K } from "@lexical/list";
|
|
3
|
+
import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { $isHeadingNode as U, $createQuoteNode as y } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as C } from "@lexical/selection";
|
|
6
|
+
import { $getNearestNodeOfType as P, mergeRegister as j } from "@lexical/utils";
|
|
7
|
+
import i from "classnames";
|
|
8
|
+
import { $getSelection as h, $isRangeSelection as p, SELECTION_CHANGE_COMMAND as H, FORMAT_TEXT_COMMAND as Q, $createParagraphNode as G } from "lexical";
|
|
9
|
+
import { useRef as V, useState as m, useCallback as X, useEffect as z } from "react";
|
|
10
|
+
import { useIntl as J } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
|
-
import { Icon as
|
|
13
|
-
import { Button as
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const t =
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
const g =
|
|
22
|
-
|
|
12
|
+
import { Icon as r } from "../../../icons/icon/Icon.js";
|
|
13
|
+
import { Button as W } from "../../../action/button/Button.js";
|
|
14
|
+
const be = (l) => {
|
|
15
|
+
const n = J(), k = 1, [a] = F(), x = V(null), [u, N] = m("paragraph"), [Y, I] = m(null), [E, A] = m(!1), [S, L] = m(!1), [v, O] = m(!1), _ = l.hideSubmit && l.hideSourceAction && l.disableRichText, b = X(() => {
|
|
16
|
+
const t = h();
|
|
17
|
+
if (p(t)) {
|
|
18
|
+
const c = t.anchor.getNode(), s = c.getKey() === "root" ? c : c.getTopLevelElementOrThrow(), d = s.getKey();
|
|
19
|
+
if (a.getElementByKey(d) !== null)
|
|
20
|
+
if (I(d), D(s)) {
|
|
21
|
+
const g = P(c, $), B = g ? g.getTag() : s.getTag();
|
|
22
|
+
N(B);
|
|
23
23
|
} else {
|
|
24
|
-
const g =
|
|
25
|
-
|
|
24
|
+
const g = U(s) ? s.getTag() : s.getType();
|
|
25
|
+
N(g);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
A(t.hasFormat("bold")), L(t.hasFormat("italic")), O(t.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
}, [a]);
|
|
30
|
+
z(() => j(
|
|
31
|
+
a.registerUpdateListener(({ editorState: t }) => {
|
|
32
32
|
t.read(() => {
|
|
33
|
-
|
|
33
|
+
b();
|
|
34
34
|
});
|
|
35
35
|
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
() => (
|
|
39
|
-
|
|
36
|
+
a.registerCommand(
|
|
37
|
+
H,
|
|
38
|
+
() => (b(), !1),
|
|
39
|
+
k
|
|
40
40
|
)
|
|
41
|
-
), [
|
|
42
|
-
const
|
|
43
|
-
t.preventDefault();
|
|
44
|
-
}, C = () => {
|
|
41
|
+
), [a, b]);
|
|
42
|
+
const M = () => {
|
|
45
43
|
setTimeout(() => {
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
a.getEditorState().read(() => {
|
|
45
|
+
b();
|
|
48
46
|
});
|
|
49
47
|
}, 0);
|
|
50
48
|
}, f = (t) => {
|
|
51
|
-
|
|
52
|
-
}, O = () => {
|
|
53
|
-
b !== "ol" ? n.dispatchCommand(K) : n.dispatchCommand(F), C();
|
|
49
|
+
a.dispatchCommand(Q, t), a.focus();
|
|
54
50
|
}, R = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
u !== "ol" ? a.dispatchCommand(q) : a.dispatchCommand(K), a.focus(), M();
|
|
52
|
+
}, w = () => {
|
|
53
|
+
u !== "quote" ? a.update(() => {
|
|
54
|
+
const t = h();
|
|
55
|
+
if (p(t))
|
|
58
56
|
if (t.isCollapsed()) {
|
|
59
|
-
const
|
|
60
|
-
|
|
57
|
+
const s = t.anchor.getNode().getTopLevelElementOrThrow(), d = y();
|
|
58
|
+
s.insertAfter(d), d.selectEnd();
|
|
61
59
|
} else
|
|
62
|
-
|
|
63
|
-
}) :
|
|
64
|
-
const t =
|
|
65
|
-
|
|
66
|
-
}),
|
|
60
|
+
C(t, () => y());
|
|
61
|
+
}) : a.update(() => {
|
|
62
|
+
const t = h();
|
|
63
|
+
p(t) && C(t, () => G());
|
|
64
|
+
}), a.focus(), M();
|
|
67
65
|
};
|
|
68
|
-
return
|
|
66
|
+
return _ ? null : /* @__PURE__ */ T(
|
|
69
67
|
"div",
|
|
70
68
|
{
|
|
71
|
-
className:
|
|
72
|
-
[e.toolbarIsActive]:
|
|
69
|
+
className: i(e.toolbar, {
|
|
70
|
+
[e.toolbarIsActive]: _ ? !1 : l.isActive
|
|
73
71
|
}),
|
|
74
|
-
ref:
|
|
72
|
+
ref: x,
|
|
75
73
|
children: [
|
|
76
|
-
l.isActive ? !l.disableRichText && /* @__PURE__ */
|
|
74
|
+
l.isActive ? !l.disableRichText && /* @__PURE__ */ T(
|
|
77
75
|
"div",
|
|
78
76
|
{
|
|
79
|
-
className:
|
|
77
|
+
className: i(e.iconToolbar, {
|
|
80
78
|
[e.shortBar]: l.shortBar
|
|
81
79
|
}),
|
|
82
80
|
children: [
|
|
83
81
|
/* @__PURE__ */ o(
|
|
84
82
|
"button",
|
|
85
83
|
{
|
|
86
|
-
onTouchStart: i,
|
|
87
|
-
onMouseDown: i,
|
|
88
84
|
onClick: () => f("bold"),
|
|
89
85
|
type: "button",
|
|
90
|
-
className:
|
|
86
|
+
className: i(e.toolbarItem, { [e.active]: E }),
|
|
91
87
|
"data-testid": "format-bold",
|
|
92
|
-
"aria-label":
|
|
88
|
+
"aria-label": n.formatMessage({
|
|
93
89
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
94
90
|
defaultMessage: "Make text bold"
|
|
95
91
|
}),
|
|
96
92
|
children: /* @__PURE__ */ o(
|
|
97
|
-
|
|
93
|
+
r,
|
|
98
94
|
{
|
|
99
95
|
name: "bold",
|
|
100
96
|
width: 24,
|
|
101
97
|
height: 24,
|
|
102
|
-
className:
|
|
98
|
+
className: i(e.format, e.bold)
|
|
103
99
|
}
|
|
104
100
|
)
|
|
105
101
|
}
|
|
@@ -107,24 +103,22 @@ const he = (l) => {
|
|
|
107
103
|
/* @__PURE__ */ o(
|
|
108
104
|
"button",
|
|
109
105
|
{
|
|
110
|
-
onTouchStart: i,
|
|
111
|
-
onMouseDown: i,
|
|
112
106
|
onClick: () => f("italic"),
|
|
113
107
|
type: "button",
|
|
114
|
-
className:
|
|
115
|
-
[e.active]:
|
|
108
|
+
className: i(e.toolbarItem, {
|
|
109
|
+
[e.active]: S
|
|
116
110
|
}),
|
|
117
|
-
"aria-label":
|
|
111
|
+
"aria-label": n.formatMessage({
|
|
118
112
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
119
113
|
defaultMessage: "Make text italic"
|
|
120
114
|
}),
|
|
121
115
|
children: /* @__PURE__ */ o(
|
|
122
|
-
|
|
116
|
+
r,
|
|
123
117
|
{
|
|
124
118
|
name: "italic",
|
|
125
119
|
width: 24,
|
|
126
120
|
height: 24,
|
|
127
|
-
className:
|
|
121
|
+
className: i(e.format, e.italic)
|
|
128
122
|
}
|
|
129
123
|
)
|
|
130
124
|
}
|
|
@@ -132,24 +126,22 @@ const he = (l) => {
|
|
|
132
126
|
/* @__PURE__ */ o(
|
|
133
127
|
"button",
|
|
134
128
|
{
|
|
135
|
-
onTouchStart: i,
|
|
136
|
-
onMouseDown: i,
|
|
137
129
|
onClick: () => f("underline"),
|
|
138
130
|
type: "button",
|
|
139
|
-
className:
|
|
140
|
-
[e.active]:
|
|
131
|
+
className: i(e.toolbarItem, {
|
|
132
|
+
[e.active]: v
|
|
141
133
|
}),
|
|
142
|
-
"aria-label":
|
|
134
|
+
"aria-label": n.formatMessage({
|
|
143
135
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
144
136
|
defaultMessage: "Underline text"
|
|
145
137
|
}),
|
|
146
138
|
children: /* @__PURE__ */ o(
|
|
147
|
-
|
|
139
|
+
r,
|
|
148
140
|
{
|
|
149
141
|
name: "underline",
|
|
150
142
|
width: 24,
|
|
151
143
|
height: 24,
|
|
152
|
-
className:
|
|
144
|
+
className: i(e.format, e.underline)
|
|
153
145
|
}
|
|
154
146
|
)
|
|
155
147
|
}
|
|
@@ -157,24 +149,22 @@ const he = (l) => {
|
|
|
157
149
|
/* @__PURE__ */ o(
|
|
158
150
|
"button",
|
|
159
151
|
{
|
|
160
|
-
|
|
161
|
-
onMouseDown: i,
|
|
162
|
-
onClick: () => R(),
|
|
152
|
+
onClick: () => w(),
|
|
163
153
|
type: "button",
|
|
164
|
-
className:
|
|
165
|
-
[e.active]:
|
|
154
|
+
className: i(e.toolbarItem, {
|
|
155
|
+
[e.active]: u === "quote"
|
|
166
156
|
}),
|
|
167
|
-
"aria-label":
|
|
157
|
+
"aria-label": n.formatMessage({
|
|
168
158
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
169
159
|
defaultMessage: "Add a blockquote"
|
|
170
160
|
}),
|
|
171
161
|
children: /* @__PURE__ */ o(
|
|
172
|
-
|
|
162
|
+
r,
|
|
173
163
|
{
|
|
174
164
|
name: "blockquote",
|
|
175
165
|
width: 24,
|
|
176
166
|
height: 24,
|
|
177
|
-
className:
|
|
167
|
+
className: i(e.format, e.quote)
|
|
178
168
|
}
|
|
179
169
|
)
|
|
180
170
|
}
|
|
@@ -182,24 +172,22 @@ const he = (l) => {
|
|
|
182
172
|
/* @__PURE__ */ o(
|
|
183
173
|
"button",
|
|
184
174
|
{
|
|
185
|
-
|
|
186
|
-
onMouseDown: i,
|
|
187
|
-
onClick: () => O(),
|
|
175
|
+
onClick: () => R(),
|
|
188
176
|
type: "button",
|
|
189
|
-
className:
|
|
190
|
-
[e.active]:
|
|
177
|
+
className: i(e.toolbarItem, {
|
|
178
|
+
[e.active]: u === "ol"
|
|
191
179
|
}),
|
|
192
|
-
"aria-label":
|
|
180
|
+
"aria-label": n.formatMessage({
|
|
193
181
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
194
182
|
defaultMessage: "Insert a numbered list"
|
|
195
183
|
}),
|
|
196
184
|
children: /* @__PURE__ */ o(
|
|
197
|
-
|
|
185
|
+
r,
|
|
198
186
|
{
|
|
199
187
|
name: "orderedList",
|
|
200
188
|
width: 24,
|
|
201
189
|
height: 24,
|
|
202
|
-
className:
|
|
190
|
+
className: i(e.format, e.numberedList)
|
|
203
191
|
}
|
|
204
192
|
)
|
|
205
193
|
}
|
|
@@ -207,22 +195,20 @@ const he = (l) => {
|
|
|
207
195
|
!l.hideSourceAction && /* @__PURE__ */ o(
|
|
208
196
|
"button",
|
|
209
197
|
{
|
|
210
|
-
onTouchStart: i,
|
|
211
|
-
onMouseDown: i,
|
|
212
198
|
onClick: l.onAddSource,
|
|
213
199
|
type: "button",
|
|
214
200
|
className: e.toolbarItem,
|
|
215
|
-
"aria-label":
|
|
201
|
+
"aria-label": n.formatMessage({
|
|
216
202
|
id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
|
|
217
203
|
defaultMessage: "Add hyperlink"
|
|
218
204
|
}),
|
|
219
205
|
children: /* @__PURE__ */ o(
|
|
220
|
-
|
|
206
|
+
r,
|
|
221
207
|
{
|
|
222
208
|
name: "link",
|
|
223
209
|
width: 20,
|
|
224
210
|
height: 20,
|
|
225
|
-
className:
|
|
211
|
+
className: i(e.format, e.link)
|
|
226
212
|
}
|
|
227
213
|
)
|
|
228
214
|
}
|
|
@@ -231,17 +217,17 @@ const he = (l) => {
|
|
|
231
217
|
}
|
|
232
218
|
) : null,
|
|
233
219
|
/* @__PURE__ */ o("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ o(
|
|
234
|
-
|
|
220
|
+
W,
|
|
235
221
|
{
|
|
236
222
|
type: "button",
|
|
237
223
|
"data-testid": "submit-button",
|
|
238
224
|
handleClick: l.onSubmit,
|
|
239
|
-
className:
|
|
240
|
-
"aria-label":
|
|
225
|
+
className: i(e.inputSubmitActionButton, e.submitAction),
|
|
226
|
+
"aria-label": n.formatMessage({
|
|
241
227
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
242
228
|
defaultMessage: "Send message"
|
|
243
229
|
}),
|
|
244
|
-
children: /* @__PURE__ */ o(
|
|
230
|
+
children: /* @__PURE__ */ o(r, { name: "send", width: 20, height: 20 })
|
|
245
231
|
}
|
|
246
232
|
) })
|
|
247
233
|
]
|
|
@@ -249,5 +235,5 @@ const he = (l) => {
|
|
|
249
235
|
);
|
|
250
236
|
};
|
|
251
237
|
export {
|
|
252
|
-
|
|
238
|
+
be as ToolbarPlugin
|
|
253
239
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-
|
|
2
|
-
toolbar:
|
|
3
|
-
toolbarIsActive:
|
|
4
|
-
iconToolbar:
|
|
5
|
-
shortBar:
|
|
6
|
-
toolbarItem:
|
|
7
|
-
active:
|
|
1
|
+
import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-C3yG2biv.css';const t = "_toolbar_awaxp_3", o = "_toolbarIsActive_awaxp_13", a = "_iconToolbar_awaxp_17", n = "_shortBar_awaxp_21", _ = "_toolbarItem_awaxp_25", c = "_active_awaxp_45", i = "_format_awaxp_49", s = "_actionButton_awaxp_56", r = "_inputSubmitActionButton_awaxp_62", b = "_submitAction_awaxp_70", u = {
|
|
2
|
+
toolbar: t,
|
|
3
|
+
toolbarIsActive: o,
|
|
4
|
+
iconToolbar: a,
|
|
5
|
+
shortBar: n,
|
|
6
|
+
toolbarItem: _,
|
|
7
|
+
active: c,
|
|
8
8
|
format: i,
|
|
9
|
-
actionButton:
|
|
10
|
-
inputSubmitActionButton:
|
|
11
|
-
submitAction:
|
|
9
|
+
actionButton: s,
|
|
10
|
+
inputSubmitActionButton: r,
|
|
11
|
+
submitAction: b
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
s as actionButton,
|
|
15
|
+
c as active,
|
|
16
16
|
u as default,
|
|
17
17
|
i as format,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
a as iconToolbar,
|
|
19
|
+
r as inputSubmitActionButton,
|
|
20
|
+
n as shortBar,
|
|
21
|
+
b as submitAction,
|
|
22
|
+
t as toolbar,
|
|
23
|
+
o as toolbarIsActive,
|
|
24
|
+
_ as toolbarItem
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._toolbar_qbyoz_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_qbyoz_3._toolbarIsActive_qbyoz_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_qbyoz_17{display:flex!important;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_qbyoz_17._shortBar_qbyoz_21{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}._toolbarItem_qbyoz_25{border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle}._toolbarItem_qbyoz_25._disabled_qbyoz_32{cursor:not-allowed}._toolbarItem_qbyoz_25._active_qbyoz_35{background-color:#bababa66;border-radius:50%}._toolbarItem_qbyoz_25 ._format_qbyoz_39{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_qbyoz_46{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_qbyoz_52{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_qbyoz_52._submitAction_qbyoz_60 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_qbyoz_52 ._inputSourceText_qbyoz_63{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_qbyoz_52 ._inputSourceText_qbyoz_63{display:block!important}}._tooltip_qbyoz_74{width:230px!important;margin-left:-117px!important}
|