@logora/debate 0.3.115 → 0.3.117

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,30 +1,30 @@
1
- import { jsxs as y, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as k, jsx as o } from "react/jsx-runtime";
2
2
  import { $isListNode as $, ListNode as q, INSERT_ORDERED_LIST_COMMAND as K, REMOVE_LIST_COMMAND as F } from "@lexical/list";
3
3
  import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
4
- import { $isHeadingNode as P, $createQuoteNode as S } from "@lexical/rich-text";
5
- import { $setBlocksType as C } from "@lexical/selection";
4
+ import { $isHeadingNode as P, $createQuoteNode as x } from "@lexical/rich-text";
5
+ import { $setBlocksType as I } from "@lexical/selection";
6
6
  import { $getNearestNodeOfType as j, mergeRegister as H } from "@lexical/utils";
7
7
  import a from "classnames";
8
- import { $getSelection as N, $isRangeSelection as M, SELECTION_CHANGE_COMMAND as Q, FORMAT_TEXT_COMMAND as G, $createParagraphNode as V } from "lexical";
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 m, 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 c } from "../../../icons/icon/Icon.js";
12
+ import { Icon as d } from "../../../icons/icon/Icon.js";
13
13
  import { Button as Y } from "../../../action/button/Button.js";
14
14
  const he = (l) => {
15
- const r = W(), k = 1, [n] = U(), x = X(null), [b, T] = m("paragraph"), [Z, I] = m(null), [E, A] = m(!1), [v, w] = m(!1), [D, L] = m(!1), _ = l.hideSubmit && l.hideSourceAction && l.disableRichText, h = z(() => {
16
- const t = N();
17
- if (M(t)) {
18
- const d = t.anchor.getNode(), s = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), u = s.getKey();
15
+ const c = W(), E = 1, [n] = U(), A = X(null), [b, M] = m("paragraph"), [Z, v] = m(null), [w, T] = m(!1), [D, _] = m(!1), [L, y] = m(!1), S = l.hideSubmit && l.hideSourceAction && l.disableRichText, h = z(() => {
16
+ const t = p();
17
+ if (N(t)) {
18
+ const s = t.anchor.getNode(), r = s.getKey() === "root" ? s : s.getTopLevelElementOrThrow(), u = r.getKey();
19
19
  if (n.getElementByKey(u) !== null)
20
- if (I(u), $(s)) {
21
- const g = j(d, q), B = g ? g.getTag() : s.getTag();
22
- T(B);
20
+ if (v(u), $(r)) {
21
+ const g = j(s, q), B = g ? g.getTag() : r.getTag();
22
+ M(B);
23
23
  } else {
24
- const g = P(s) ? s.getTag() : s.getType();
25
- T(g);
24
+ const g = P(r) ? r.getTag() : r.getType();
25
+ M(g);
26
26
  }
27
- A(t.hasFormat("bold")), w(t.hasFormat("italic")), L(t.hasFormat("underline"));
27
+ T(t.hasFormat("bold")), _(t.hasFormat("italic")), y(t.hasFormat("underline"));
28
28
  }
29
29
  }, [n]);
30
30
  J(() => H(
@@ -36,44 +36,44 @@ const he = (l) => {
36
36
  n.registerCommand(
37
37
  Q,
38
38
  () => (h(), !1),
39
- k
39
+ E
40
40
  )
41
41
  ), [n, h]);
42
42
  const i = (t) => {
43
43
  t.preventDefault();
44
- }, f = () => {
44
+ }, C = () => {
45
45
  setTimeout(() => {
46
46
  n.getEditorState().read(() => {
47
47
  h();
48
48
  });
49
49
  }, 0);
50
- }, p = (t) => {
51
- n.dispatchCommand(G, t), f();
50
+ }, f = (t) => {
51
+ n.dispatchCommand(G, t), t === "bold" && T((s) => !s), t === "italic" && _((s) => !s), t === "underline" && y((s) => !s);
52
52
  }, O = () => {
53
- b !== "ol" ? n.dispatchCommand(K) : n.dispatchCommand(F), f();
53
+ b !== "ol" ? n.dispatchCommand(K) : n.dispatchCommand(F), C();
54
54
  }, R = () => {
55
55
  b !== "quote" ? n.update(() => {
56
- const t = N();
57
- if (M(t))
56
+ const t = p();
57
+ if (N(t))
58
58
  if (t.isCollapsed()) {
59
- const s = t.anchor.getNode().getTopLevelElementOrThrow(), u = S();
60
- s.insertAfter(u), u.selectEnd();
59
+ const r = t.anchor.getNode().getTopLevelElementOrThrow(), u = x();
60
+ r.insertAfter(u), u.selectEnd();
61
61
  } else
62
- C(t, () => S());
62
+ I(t, () => x());
63
63
  }) : n.update(() => {
64
- const t = N();
65
- M(t) && C(t, () => V());
66
- }), f();
64
+ const t = p();
65
+ N(t) && I(t, () => V());
66
+ }), C();
67
67
  };
68
- return _ ? null : /* @__PURE__ */ y(
68
+ return S ? null : /* @__PURE__ */ k(
69
69
  "div",
70
70
  {
71
71
  className: a(e.toolbar, {
72
- [e.toolbarIsActive]: _ ? !1 : l.isActive
72
+ [e.toolbarIsActive]: S ? !1 : l.isActive
73
73
  }),
74
- ref: x,
74
+ ref: A,
75
75
  children: [
76
- l.isActive ? !l.disableRichText && /* @__PURE__ */ y(
76
+ l.isActive ? !l.disableRichText && /* @__PURE__ */ k(
77
77
  "div",
78
78
  {
79
79
  className: a(e.iconToolbar, {
@@ -85,16 +85,16 @@ const he = (l) => {
85
85
  {
86
86
  onTouchStart: i,
87
87
  onMouseDown: i,
88
- onClick: () => p("bold"),
88
+ onClick: () => f("bold"),
89
89
  type: "button",
90
- className: a(e.toolbarItem, { [e.active]: E }),
90
+ className: a(e.toolbarItem, { [e.active]: w }),
91
91
  "data-testid": "format-bold",
92
- "aria-label": r.formatMessage({
92
+ "aria-label": c.formatMessage({
93
93
  id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
94
94
  defaultMessage: "Make text bold"
95
95
  }),
96
96
  children: /* @__PURE__ */ o(
97
- c,
97
+ d,
98
98
  {
99
99
  name: "bold",
100
100
  width: 24,
@@ -109,17 +109,17 @@ const he = (l) => {
109
109
  {
110
110
  onTouchStart: i,
111
111
  onMouseDown: i,
112
- onClick: () => p("italic"),
112
+ onClick: () => f("italic"),
113
113
  type: "button",
114
114
  className: a(e.toolbarItem, {
115
- [e.active]: v
115
+ [e.active]: D
116
116
  }),
117
- "aria-label": r.formatMessage({
117
+ "aria-label": c.formatMessage({
118
118
  id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
119
119
  defaultMessage: "Make text italic"
120
120
  }),
121
121
  children: /* @__PURE__ */ o(
122
- c,
122
+ d,
123
123
  {
124
124
  name: "italic",
125
125
  width: 24,
@@ -134,17 +134,17 @@ const he = (l) => {
134
134
  {
135
135
  onTouchStart: i,
136
136
  onMouseDown: i,
137
- onClick: () => p("underline"),
137
+ onClick: () => f("underline"),
138
138
  type: "button",
139
139
  className: a(e.toolbarItem, {
140
- [e.active]: D
140
+ [e.active]: L
141
141
  }),
142
- "aria-label": r.formatMessage({
142
+ "aria-label": c.formatMessage({
143
143
  id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
144
144
  defaultMessage: "Underline text"
145
145
  }),
146
146
  children: /* @__PURE__ */ o(
147
- c,
147
+ d,
148
148
  {
149
149
  name: "underline",
150
150
  width: 24,
@@ -164,12 +164,12 @@ const he = (l) => {
164
164
  className: a(e.toolbarItem, {
165
165
  [e.active]: b === "quote"
166
166
  }),
167
- "aria-label": r.formatMessage({
167
+ "aria-label": c.formatMessage({
168
168
  id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
169
169
  defaultMessage: "Add a blockquote"
170
170
  }),
171
171
  children: /* @__PURE__ */ o(
172
- c,
172
+ d,
173
173
  {
174
174
  name: "blockquote",
175
175
  width: 24,
@@ -189,12 +189,12 @@ const he = (l) => {
189
189
  className: a(e.toolbarItem, {
190
190
  [e.active]: b === "ol"
191
191
  }),
192
- "aria-label": r.formatMessage({
192
+ "aria-label": c.formatMessage({
193
193
  id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
194
194
  defaultMessage: "Insert a numbered list"
195
195
  }),
196
196
  children: /* @__PURE__ */ o(
197
- c,
197
+ d,
198
198
  {
199
199
  name: "orderedList",
200
200
  width: 24,
@@ -212,12 +212,12 @@ const he = (l) => {
212
212
  onClick: l.onAddSource,
213
213
  type: "button",
214
214
  className: e.toolbarItem,
215
- "aria-label": r.formatMessage({
215
+ "aria-label": c.formatMessage({
216
216
  id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
217
217
  defaultMessage: "Add hyperlink"
218
218
  }),
219
219
  children: /* @__PURE__ */ o(
220
- c,
220
+ d,
221
221
  {
222
222
  name: "link",
223
223
  width: 20,
@@ -237,11 +237,11 @@ const he = (l) => {
237
237
  "data-testid": "submit-button",
238
238
  handleClick: l.onSubmit,
239
239
  className: a(e.inputSubmitActionButton, e.submitAction),
240
- "aria-label": r.formatMessage({
240
+ "aria-label": c.formatMessage({
241
241
  id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
242
242
  defaultMessage: "Send message"
243
243
  }),
244
- children: /* @__PURE__ */ o(c, { name: "send", width: 20, height: 20 })
244
+ children: /* @__PURE__ */ o(d, { name: "send", width: 20, height: 20 })
245
245
  }
246
246
  ) })
247
247
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.115",
3
+ "version": "0.3.117",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",