@logora/debate 0.4.20 → 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 +98 -106
- 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,104 +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
|
|
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
|
|
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
|
-
}, k = () => {
|
|
41
|
+
), [a, b]);
|
|
42
|
+
const M = () => {
|
|
45
43
|
setTimeout(() => {
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
a.getEditorState().read(() => {
|
|
45
|
+
b();
|
|
48
46
|
});
|
|
49
47
|
}, 0);
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
}, O = () => {
|
|
53
|
-
b !== "ol" ? l.dispatchCommand(K) : l.dispatchCommand(F), k();
|
|
48
|
+
}, f = (t) => {
|
|
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 s = t.anchor.getNode().getTopLevelElementOrThrow(),
|
|
60
|
-
s.insertAfter(
|
|
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
|
-
|
|
74
|
+
l.isActive ? !l.disableRichText && /* @__PURE__ */ T(
|
|
77
75
|
"div",
|
|
78
76
|
{
|
|
79
|
-
className:
|
|
80
|
-
[e.shortBar]:
|
|
77
|
+
className: i(e.iconToolbar, {
|
|
78
|
+
[e.shortBar]: l.shortBar
|
|
81
79
|
}),
|
|
82
80
|
children: [
|
|
83
81
|
/* @__PURE__ */ o(
|
|
84
82
|
"button",
|
|
85
83
|
{
|
|
86
|
-
|
|
87
|
-
onClick: () => h("bold"),
|
|
84
|
+
onClick: () => f("bold"),
|
|
88
85
|
type: "button",
|
|
89
|
-
className:
|
|
86
|
+
className: i(e.toolbarItem, { [e.active]: E }),
|
|
90
87
|
"data-testid": "format-bold",
|
|
91
|
-
"aria-label":
|
|
88
|
+
"aria-label": n.formatMessage({
|
|
92
89
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
93
90
|
defaultMessage: "Make text bold"
|
|
94
91
|
}),
|
|
95
92
|
children: /* @__PURE__ */ o(
|
|
96
|
-
|
|
93
|
+
r,
|
|
97
94
|
{
|
|
98
95
|
name: "bold",
|
|
99
96
|
width: 24,
|
|
100
97
|
height: 24,
|
|
101
|
-
className:
|
|
98
|
+
className: i(e.format, e.bold)
|
|
102
99
|
}
|
|
103
100
|
)
|
|
104
101
|
}
|
|
@@ -106,23 +103,22 @@ const ge = (i) => {
|
|
|
106
103
|
/* @__PURE__ */ o(
|
|
107
104
|
"button",
|
|
108
105
|
{
|
|
109
|
-
|
|
110
|
-
onClick: () => h("italic"),
|
|
106
|
+
onClick: () => f("italic"),
|
|
111
107
|
type: "button",
|
|
112
|
-
className:
|
|
113
|
-
[e.active]:
|
|
108
|
+
className: i(e.toolbarItem, {
|
|
109
|
+
[e.active]: S
|
|
114
110
|
}),
|
|
115
|
-
"aria-label":
|
|
111
|
+
"aria-label": n.formatMessage({
|
|
116
112
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
117
113
|
defaultMessage: "Make text italic"
|
|
118
114
|
}),
|
|
119
115
|
children: /* @__PURE__ */ o(
|
|
120
|
-
|
|
116
|
+
r,
|
|
121
117
|
{
|
|
122
118
|
name: "italic",
|
|
123
119
|
width: 24,
|
|
124
120
|
height: 24,
|
|
125
|
-
className:
|
|
121
|
+
className: i(e.format, e.italic)
|
|
126
122
|
}
|
|
127
123
|
)
|
|
128
124
|
}
|
|
@@ -130,23 +126,22 @@ const ge = (i) => {
|
|
|
130
126
|
/* @__PURE__ */ o(
|
|
131
127
|
"button",
|
|
132
128
|
{
|
|
133
|
-
|
|
134
|
-
onClick: () => h("underline"),
|
|
129
|
+
onClick: () => f("underline"),
|
|
135
130
|
type: "button",
|
|
136
|
-
className:
|
|
137
|
-
[e.active]:
|
|
131
|
+
className: i(e.toolbarItem, {
|
|
132
|
+
[e.active]: v
|
|
138
133
|
}),
|
|
139
|
-
"aria-label":
|
|
134
|
+
"aria-label": n.formatMessage({
|
|
140
135
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
141
136
|
defaultMessage: "Underline text"
|
|
142
137
|
}),
|
|
143
138
|
children: /* @__PURE__ */ o(
|
|
144
|
-
|
|
139
|
+
r,
|
|
145
140
|
{
|
|
146
141
|
name: "underline",
|
|
147
142
|
width: 24,
|
|
148
143
|
height: 24,
|
|
149
|
-
className:
|
|
144
|
+
className: i(e.format, e.underline)
|
|
150
145
|
}
|
|
151
146
|
)
|
|
152
147
|
}
|
|
@@ -154,23 +149,22 @@ const ge = (i) => {
|
|
|
154
149
|
/* @__PURE__ */ o(
|
|
155
150
|
"button",
|
|
156
151
|
{
|
|
157
|
-
|
|
158
|
-
onClick: () => R(),
|
|
152
|
+
onClick: () => w(),
|
|
159
153
|
type: "button",
|
|
160
|
-
className:
|
|
161
|
-
[e.active]:
|
|
154
|
+
className: i(e.toolbarItem, {
|
|
155
|
+
[e.active]: u === "quote"
|
|
162
156
|
}),
|
|
163
|
-
"aria-label":
|
|
157
|
+
"aria-label": n.formatMessage({
|
|
164
158
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
165
159
|
defaultMessage: "Add a blockquote"
|
|
166
160
|
}),
|
|
167
161
|
children: /* @__PURE__ */ o(
|
|
168
|
-
|
|
162
|
+
r,
|
|
169
163
|
{
|
|
170
164
|
name: "blockquote",
|
|
171
165
|
width: 24,
|
|
172
166
|
height: 24,
|
|
173
|
-
className:
|
|
167
|
+
className: i(e.format, e.quote)
|
|
174
168
|
}
|
|
175
169
|
)
|
|
176
170
|
}
|
|
@@ -178,45 +172,43 @@ const ge = (i) => {
|
|
|
178
172
|
/* @__PURE__ */ o(
|
|
179
173
|
"button",
|
|
180
174
|
{
|
|
181
|
-
|
|
182
|
-
onClick: () => O(),
|
|
175
|
+
onClick: () => R(),
|
|
183
176
|
type: "button",
|
|
184
|
-
className:
|
|
185
|
-
[e.active]:
|
|
177
|
+
className: i(e.toolbarItem, {
|
|
178
|
+
[e.active]: u === "ol"
|
|
186
179
|
}),
|
|
187
|
-
"aria-label":
|
|
180
|
+
"aria-label": n.formatMessage({
|
|
188
181
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
189
182
|
defaultMessage: "Insert a numbered list"
|
|
190
183
|
}),
|
|
191
184
|
children: /* @__PURE__ */ o(
|
|
192
|
-
|
|
185
|
+
r,
|
|
193
186
|
{
|
|
194
187
|
name: "orderedList",
|
|
195
188
|
width: 24,
|
|
196
189
|
height: 24,
|
|
197
|
-
className:
|
|
190
|
+
className: i(e.format, e.numberedList)
|
|
198
191
|
}
|
|
199
192
|
)
|
|
200
193
|
}
|
|
201
194
|
),
|
|
202
|
-
!
|
|
195
|
+
!l.hideSourceAction && /* @__PURE__ */ o(
|
|
203
196
|
"button",
|
|
204
197
|
{
|
|
205
|
-
|
|
206
|
-
onClick: i.onAddSource,
|
|
198
|
+
onClick: l.onAddSource,
|
|
207
199
|
type: "button",
|
|
208
200
|
className: e.toolbarItem,
|
|
209
|
-
"aria-label":
|
|
201
|
+
"aria-label": n.formatMessage({
|
|
210
202
|
id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
|
|
211
203
|
defaultMessage: "Add hyperlink"
|
|
212
204
|
}),
|
|
213
205
|
children: /* @__PURE__ */ o(
|
|
214
|
-
|
|
206
|
+
r,
|
|
215
207
|
{
|
|
216
208
|
name: "link",
|
|
217
209
|
width: 20,
|
|
218
210
|
height: 20,
|
|
219
|
-
className:
|
|
211
|
+
className: i(e.format, e.link)
|
|
220
212
|
}
|
|
221
213
|
)
|
|
222
214
|
}
|
|
@@ -224,18 +216,18 @@ const ge = (i) => {
|
|
|
224
216
|
]
|
|
225
217
|
}
|
|
226
218
|
) : null,
|
|
227
|
-
/* @__PURE__ */ o("div", { className: e.actionButton, children:
|
|
228
|
-
|
|
219
|
+
/* @__PURE__ */ o("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ o(
|
|
220
|
+
W,
|
|
229
221
|
{
|
|
230
222
|
type: "button",
|
|
231
223
|
"data-testid": "submit-button",
|
|
232
|
-
handleClick:
|
|
233
|
-
className:
|
|
234
|
-
"aria-label":
|
|
224
|
+
handleClick: l.onSubmit,
|
|
225
|
+
className: i(e.inputSubmitActionButton, e.submitAction),
|
|
226
|
+
"aria-label": n.formatMessage({
|
|
235
227
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
236
228
|
defaultMessage: "Send message"
|
|
237
229
|
}),
|
|
238
|
-
children: /* @__PURE__ */ o(
|
|
230
|
+
children: /* @__PURE__ */ o(r, { name: "send", width: 20, height: 20 })
|
|
239
231
|
}
|
|
240
232
|
) })
|
|
241
233
|
]
|
|
@@ -243,5 +235,5 @@ const ge = (i) => {
|
|
|
243
235
|
);
|
|
244
236
|
};
|
|
245
237
|
export {
|
|
246
|
-
|
|
238
|
+
be as ToolbarPlugin
|
|
247
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}
|