@logora/debate 0.4.20 → 0.4.22
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 +51 -51
- 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,30 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { $isListNode as
|
|
3
|
-
import { useLexicalComposerContext as
|
|
4
|
-
import { $isHeadingNode as
|
|
5
|
-
import { $setBlocksType as
|
|
1
|
+
import { jsxs as y, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { $isListNode as P, 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 C } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as k } from "@lexical/selection";
|
|
6
6
|
import { $getNearestNodeOfType as j, mergeRegister as H } from "@lexical/utils";
|
|
7
7
|
import a from "classnames";
|
|
8
8
|
import { $getSelection as p, $isRangeSelection as N, SELECTION_CHANGE_COMMAND as Q, FORMAT_TEXT_COMMAND as G, $createParagraphNode as V } from "lexical";
|
|
9
9
|
import { useRef as X, useState as u, useCallback as z, useEffect as J } from "react";
|
|
10
10
|
import { useIntl as W } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
|
-
import { Icon as
|
|
12
|
+
import { Icon as r } from "../../../icons/icon/Icon.js";
|
|
13
13
|
import { Button as Y } from "../../../action/button/Button.js";
|
|
14
14
|
const ge = (i) => {
|
|
15
|
-
const
|
|
15
|
+
const s = W(), x = 1, [l] = F(), I = X(null), [b, _] = u("paragraph"), [Z, E] = u(null), [S, A] = u(!1), [w, D] = u(!1), [L, v] = u(!1), T = i.hideSubmit && i.hideSourceAction && i.disableRichText, g = z(() => {
|
|
16
16
|
const t = p();
|
|
17
17
|
if (N(t)) {
|
|
18
|
-
const
|
|
18
|
+
const d = t.anchor.getNode(), n = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), m = n.getKey();
|
|
19
19
|
if (l.getElementByKey(m) !== null)
|
|
20
|
-
if (
|
|
21
|
-
const f = j(
|
|
22
|
-
|
|
20
|
+
if (E(m), P(n)) {
|
|
21
|
+
const f = j(d, $), B = f ? f.getTag() : n.getTag();
|
|
22
|
+
_(B);
|
|
23
23
|
} else {
|
|
24
|
-
const f =
|
|
25
|
-
|
|
24
|
+
const f = U(n) ? n.getTag() : n.getType();
|
|
25
|
+
_(f);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
A(t.hasFormat("bold")), D(t.hasFormat("italic")), v(t.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
29
|
}, [l]);
|
|
30
30
|
J(() => H(
|
|
@@ -36,44 +36,44 @@ const ge = (i) => {
|
|
|
36
36
|
l.registerCommand(
|
|
37
37
|
Q,
|
|
38
38
|
() => (g(), !1),
|
|
39
|
-
|
|
39
|
+
x
|
|
40
40
|
)
|
|
41
41
|
), [l, g]);
|
|
42
|
-
const
|
|
43
|
-
t.preventDefault();
|
|
44
|
-
},
|
|
42
|
+
const c = (t) => {
|
|
43
|
+
t.pointerType !== "touch" && t.pointerType !== "pen" && t.preventDefault();
|
|
44
|
+
}, M = () => {
|
|
45
45
|
setTimeout(() => {
|
|
46
46
|
l.getEditorState().read(() => {
|
|
47
47
|
g();
|
|
48
48
|
});
|
|
49
49
|
}, 0);
|
|
50
50
|
}, h = (t) => {
|
|
51
|
-
l.dispatchCommand(G, t)
|
|
51
|
+
l.dispatchCommand(G, t);
|
|
52
52
|
}, O = () => {
|
|
53
|
-
b !== "ol" ? l.dispatchCommand(
|
|
53
|
+
b !== "ol" ? l.dispatchCommand(q) : l.dispatchCommand(K), M();
|
|
54
54
|
}, R = () => {
|
|
55
55
|
b !== "quote" ? l.update(() => {
|
|
56
56
|
const t = p();
|
|
57
57
|
if (N(t))
|
|
58
58
|
if (t.isCollapsed()) {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const n = t.anchor.getNode().getTopLevelElementOrThrow(), m = C();
|
|
60
|
+
n.insertAfter(m), m.selectEnd();
|
|
61
61
|
} else
|
|
62
|
-
|
|
62
|
+
k(t, () => C());
|
|
63
63
|
}) : l.update(() => {
|
|
64
64
|
const t = p();
|
|
65
|
-
N(t) &&
|
|
66
|
-
}),
|
|
65
|
+
N(t) && k(t, () => V());
|
|
66
|
+
}), M();
|
|
67
67
|
};
|
|
68
|
-
return
|
|
68
|
+
return T ? null : /* @__PURE__ */ y(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
71
|
className: a(e.toolbar, {
|
|
72
|
-
[e.toolbarIsActive]:
|
|
72
|
+
[e.toolbarIsActive]: T ? !1 : i.isActive
|
|
73
73
|
}),
|
|
74
|
-
ref:
|
|
74
|
+
ref: I,
|
|
75
75
|
children: [
|
|
76
|
-
i.isActive ? !i.disableRichText && /* @__PURE__ */
|
|
76
|
+
i.isActive ? !i.disableRichText && /* @__PURE__ */ y(
|
|
77
77
|
"div",
|
|
78
78
|
{
|
|
79
79
|
className: a(e.iconToolbar, {
|
|
@@ -83,17 +83,17 @@ const ge = (i) => {
|
|
|
83
83
|
/* @__PURE__ */ o(
|
|
84
84
|
"button",
|
|
85
85
|
{
|
|
86
|
-
|
|
86
|
+
onPointerDown: c,
|
|
87
87
|
onClick: () => h("bold"),
|
|
88
88
|
type: "button",
|
|
89
|
-
className: a(e.toolbarItem, { [e.active]:
|
|
89
|
+
className: a(e.toolbarItem, { [e.active]: S }),
|
|
90
90
|
"data-testid": "format-bold",
|
|
91
|
-
"aria-label":
|
|
91
|
+
"aria-label": s.formatMessage({
|
|
92
92
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
93
93
|
defaultMessage: "Make text bold"
|
|
94
94
|
}),
|
|
95
95
|
children: /* @__PURE__ */ o(
|
|
96
|
-
|
|
96
|
+
r,
|
|
97
97
|
{
|
|
98
98
|
name: "bold",
|
|
99
99
|
width: 24,
|
|
@@ -106,18 +106,18 @@ const ge = (i) => {
|
|
|
106
106
|
/* @__PURE__ */ o(
|
|
107
107
|
"button",
|
|
108
108
|
{
|
|
109
|
-
|
|
109
|
+
onPointerDown: c,
|
|
110
110
|
onClick: () => h("italic"),
|
|
111
111
|
type: "button",
|
|
112
112
|
className: a(e.toolbarItem, {
|
|
113
|
-
[e.active]:
|
|
113
|
+
[e.active]: w
|
|
114
114
|
}),
|
|
115
|
-
"aria-label":
|
|
115
|
+
"aria-label": s.formatMessage({
|
|
116
116
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
117
117
|
defaultMessage: "Make text italic"
|
|
118
118
|
}),
|
|
119
119
|
children: /* @__PURE__ */ o(
|
|
120
|
-
|
|
120
|
+
r,
|
|
121
121
|
{
|
|
122
122
|
name: "italic",
|
|
123
123
|
width: 24,
|
|
@@ -130,18 +130,18 @@ const ge = (i) => {
|
|
|
130
130
|
/* @__PURE__ */ o(
|
|
131
131
|
"button",
|
|
132
132
|
{
|
|
133
|
-
|
|
133
|
+
onPointerDown: c,
|
|
134
134
|
onClick: () => h("underline"),
|
|
135
135
|
type: "button",
|
|
136
136
|
className: a(e.toolbarItem, {
|
|
137
137
|
[e.active]: L
|
|
138
138
|
}),
|
|
139
|
-
"aria-label":
|
|
139
|
+
"aria-label": s.formatMessage({
|
|
140
140
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
141
141
|
defaultMessage: "Underline text"
|
|
142
142
|
}),
|
|
143
143
|
children: /* @__PURE__ */ o(
|
|
144
|
-
|
|
144
|
+
r,
|
|
145
145
|
{
|
|
146
146
|
name: "underline",
|
|
147
147
|
width: 24,
|
|
@@ -154,18 +154,18 @@ const ge = (i) => {
|
|
|
154
154
|
/* @__PURE__ */ o(
|
|
155
155
|
"button",
|
|
156
156
|
{
|
|
157
|
-
|
|
157
|
+
onPointerDown: c,
|
|
158
158
|
onClick: () => R(),
|
|
159
159
|
type: "button",
|
|
160
160
|
className: a(e.toolbarItem, {
|
|
161
161
|
[e.active]: b === "quote"
|
|
162
162
|
}),
|
|
163
|
-
"aria-label":
|
|
163
|
+
"aria-label": s.formatMessage({
|
|
164
164
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
165
165
|
defaultMessage: "Add a blockquote"
|
|
166
166
|
}),
|
|
167
167
|
children: /* @__PURE__ */ o(
|
|
168
|
-
|
|
168
|
+
r,
|
|
169
169
|
{
|
|
170
170
|
name: "blockquote",
|
|
171
171
|
width: 24,
|
|
@@ -178,18 +178,18 @@ const ge = (i) => {
|
|
|
178
178
|
/* @__PURE__ */ o(
|
|
179
179
|
"button",
|
|
180
180
|
{
|
|
181
|
-
|
|
181
|
+
onPointerDown: c,
|
|
182
182
|
onClick: () => O(),
|
|
183
183
|
type: "button",
|
|
184
184
|
className: a(e.toolbarItem, {
|
|
185
185
|
[e.active]: b === "ol"
|
|
186
186
|
}),
|
|
187
|
-
"aria-label":
|
|
187
|
+
"aria-label": s.formatMessage({
|
|
188
188
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
189
189
|
defaultMessage: "Insert a numbered list"
|
|
190
190
|
}),
|
|
191
191
|
children: /* @__PURE__ */ o(
|
|
192
|
-
|
|
192
|
+
r,
|
|
193
193
|
{
|
|
194
194
|
name: "orderedList",
|
|
195
195
|
width: 24,
|
|
@@ -202,16 +202,16 @@ const ge = (i) => {
|
|
|
202
202
|
!i.hideSourceAction && /* @__PURE__ */ o(
|
|
203
203
|
"button",
|
|
204
204
|
{
|
|
205
|
-
|
|
205
|
+
onPointerDown: c,
|
|
206
206
|
onClick: i.onAddSource,
|
|
207
207
|
type: "button",
|
|
208
208
|
className: e.toolbarItem,
|
|
209
|
-
"aria-label":
|
|
209
|
+
"aria-label": s.formatMessage({
|
|
210
210
|
id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
|
|
211
211
|
defaultMessage: "Add hyperlink"
|
|
212
212
|
}),
|
|
213
213
|
children: /* @__PURE__ */ o(
|
|
214
|
-
|
|
214
|
+
r,
|
|
215
215
|
{
|
|
216
216
|
name: "link",
|
|
217
217
|
width: 20,
|
|
@@ -231,11 +231,11 @@ const ge = (i) => {
|
|
|
231
231
|
"data-testid": "submit-button",
|
|
232
232
|
handleClick: i.onSubmit,
|
|
233
233
|
className: a(e.inputSubmitActionButton, e.submitAction),
|
|
234
|
-
"aria-label":
|
|
234
|
+
"aria-label": s.formatMessage({
|
|
235
235
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
236
236
|
defaultMessage: "Send message"
|
|
237
237
|
}),
|
|
238
|
-
children: /* @__PURE__ */ o(
|
|
238
|
+
children: /* @__PURE__ */ o(r, { name: "send", width: 20, height: 20 })
|
|
239
239
|
}
|
|
240
240
|
) })
|
|
241
241
|
]
|
|
@@ -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}
|