@layers-app/shared 0.0.27 → 0.0.28
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/components/CommentComposer/index.d.ts +52 -0
- package/dist/components/CommentsPanel/components/CommentActions.d.ts +16 -0
- package/dist/components/CommentsPanel/components/CommentFilterMenu.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentPanelListItem.d.ts +22 -0
- package/dist/components/CommentsPanel/components/CommentsEmptyPlaceholder.d.ts +3 -0
- package/dist/components/CommentsPanel/components/CommentsFilterHeader.d.ts +3 -0
- package/dist/components/CommentsPanel/components/CommentsListItemMenu.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentsMultiSelectUsers.d.ts +6 -0
- package/dist/components/CommentsPanel/components/CommentsPanelList.d.ts +19 -0
- package/dist/components/CommentsPanel/components/CommentsThreadReplyControls.d.ts +10 -0
- package/dist/components/CommentsPanel/components/CommentsUploadFilesPreview.d.ts +5 -0
- package/dist/components/CommentsPanel/components/Icon.d.ts +8 -0
- package/dist/components/CommentsPanel/components/RemoveConfirmModal.d.ts +11 -0
- package/dist/components/CommentsPanel/index.d.ts +21 -0
- package/dist/components/CommentsPanel/store.d.ts +19 -0
- package/dist/components/CommentsPanel/types.d.ts +243 -0
- package/dist/components/CommentsPanel/utils.d.ts +8 -0
- package/dist/helpers/getFileIcons.d.ts +1 -0
- package/dist/helpers/getFileType.d.ts +1 -0
- package/dist/index-Bz8Yenv3.js +75975 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +102 -46106
- package/dist/index.umd.cjs +269 -77
- package/dist/layers.C5oAiCeN-DZQs9zcO.js +288 -0
- package/dist/layers.CovbS90x-CThbTGYw.js +52 -0
- package/dist/layers.CsuN1Q94-BT7000dw.js +170 -0
- package/dist/layers.DETHwCxI-BvdKGW_B.js +281 -0
- package/dist/layers.vNINlb5t-Bef3Moef.js +289 -0
- package/package.json +2 -2
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { jsxs as g, Fragment as U, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as I, useCallback as E, useEffect as P, Suspense as F } from "react";
|
|
3
|
+
import { u as j, a as q, O as A, d as M, s as O, x as _, L as k, b as Q, B as $, c as W, f as z, g as h, M as G, i as H, Q as J, q as V, U as X, j as Y, k as Z, m as ee, r as te, $ as ae, n as ne } from "./index-Bz8Yenv3.js";
|
|
4
|
+
import { S as le, W as re } from "./layers.CovbS90x-CThbTGYw.js";
|
|
5
|
+
import { TextInput as ie } from "@mantine/core";
|
|
6
|
+
function oe({
|
|
7
|
+
children: a,
|
|
8
|
+
label: i,
|
|
9
|
+
className: t,
|
|
10
|
+
...n
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ g("div", { className: "Input__wrapper", children: [
|
|
13
|
+
/* @__PURE__ */ e("label", { style: { marginTop: "-1em" }, className: "Input__label", children: i }),
|
|
14
|
+
/* @__PURE__ */ e("select", { ...n, className: t || "select", children: a })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
function se({
|
|
18
|
+
label: a,
|
|
19
|
+
value: i,
|
|
20
|
+
onChange: t,
|
|
21
|
+
placeholder: n = "",
|
|
22
|
+
"data-test-id": p,
|
|
23
|
+
type: u = "text"
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ e(
|
|
26
|
+
ie,
|
|
27
|
+
{
|
|
28
|
+
type: u,
|
|
29
|
+
placeholder: n,
|
|
30
|
+
value: i,
|
|
31
|
+
onChange: (r) => {
|
|
32
|
+
t(r.target.value);
|
|
33
|
+
},
|
|
34
|
+
label: a,
|
|
35
|
+
"data-test-id": p,
|
|
36
|
+
mb: 10
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const D = /* @__PURE__ */ new Set();
|
|
41
|
+
function de(a) {
|
|
42
|
+
if (!D.has(a))
|
|
43
|
+
throw new Promise((i) => {
|
|
44
|
+
const t = new Image();
|
|
45
|
+
t.src = a, t.onload = () => {
|
|
46
|
+
D.add(a), i(null);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function ce({
|
|
51
|
+
altText: a,
|
|
52
|
+
className: i,
|
|
53
|
+
imageRef: t,
|
|
54
|
+
src: n,
|
|
55
|
+
width: p,
|
|
56
|
+
height: u,
|
|
57
|
+
position: r
|
|
58
|
+
}) {
|
|
59
|
+
return de(n), /* @__PURE__ */ e(
|
|
60
|
+
"img",
|
|
61
|
+
{
|
|
62
|
+
className: i || void 0,
|
|
63
|
+
src: n,
|
|
64
|
+
alt: a,
|
|
65
|
+
ref: t,
|
|
66
|
+
"data-position": r,
|
|
67
|
+
style: {
|
|
68
|
+
display: "block",
|
|
69
|
+
height: u,
|
|
70
|
+
width: p
|
|
71
|
+
},
|
|
72
|
+
draggable: "false"
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function ue({
|
|
77
|
+
activeEditor: a,
|
|
78
|
+
nodeKey: i,
|
|
79
|
+
onClose: t
|
|
80
|
+
}) {
|
|
81
|
+
const n = a.getEditorState().read(
|
|
82
|
+
() => j(i)
|
|
83
|
+
), [p, u] = x(n.getAltText()), [r, N] = x(n.getShowCaption()), [v, w] = x(n.getPosition()), f = (o) => {
|
|
84
|
+
N(o.target.checked);
|
|
85
|
+
}, b = (o) => {
|
|
86
|
+
w(o.target.value);
|
|
87
|
+
}, m = () => {
|
|
88
|
+
const o = { altText: p, position: v, showCaption: r };
|
|
89
|
+
n && a.update(() => {
|
|
90
|
+
n.update(o);
|
|
91
|
+
}), t();
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ g(U, { children: [
|
|
94
|
+
/* @__PURE__ */ e("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ e(
|
|
95
|
+
se,
|
|
96
|
+
{
|
|
97
|
+
label: "Alt-текст",
|
|
98
|
+
placeholder: "Альтернативный текст",
|
|
99
|
+
onChange: u,
|
|
100
|
+
value: p,
|
|
101
|
+
"data-test-id": "image-modal-alt-text-input"
|
|
102
|
+
}
|
|
103
|
+
) }),
|
|
104
|
+
/* @__PURE__ */ g(
|
|
105
|
+
oe,
|
|
106
|
+
{
|
|
107
|
+
style: { marginBottom: "1em", width: "208px" },
|
|
108
|
+
value: v,
|
|
109
|
+
label: "Position",
|
|
110
|
+
name: "position",
|
|
111
|
+
id: "position-select",
|
|
112
|
+
onChange: b,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ e("option", { value: "left", children: "Left" }),
|
|
115
|
+
/* @__PURE__ */ e("option", { value: "right", children: "Right" }),
|
|
116
|
+
/* @__PURE__ */ e("option", { value: "full", children: "Full Width" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ g("div", { className: "Input__wrapper", children: [
|
|
121
|
+
/* @__PURE__ */ e(
|
|
122
|
+
"input",
|
|
123
|
+
{
|
|
124
|
+
id: "caption",
|
|
125
|
+
type: "checkbox",
|
|
126
|
+
checked: r,
|
|
127
|
+
onChange: f
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ e("label", { htmlFor: "caption", children: "Show Caption" })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ e(
|
|
133
|
+
q,
|
|
134
|
+
{
|
|
135
|
+
"data-test-id": "image-modal-file-upload-btn",
|
|
136
|
+
onClick: () => m(),
|
|
137
|
+
children: "Применить"
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
function be({
|
|
143
|
+
src: a,
|
|
144
|
+
altText: i,
|
|
145
|
+
nodeKey: t,
|
|
146
|
+
width: n,
|
|
147
|
+
height: p,
|
|
148
|
+
showCaption: u,
|
|
149
|
+
caption: r,
|
|
150
|
+
position: N
|
|
151
|
+
}) {
|
|
152
|
+
const [v, w] = A(), f = I(null), b = I(null), [m, o, S] = M(t), [l] = O(), [K, L] = x(null), T = I(null), y = E(
|
|
153
|
+
(s) => {
|
|
154
|
+
if (m && _(k())) {
|
|
155
|
+
s.preventDefault();
|
|
156
|
+
const c = j(t);
|
|
157
|
+
Q(c) && c.remove();
|
|
158
|
+
}
|
|
159
|
+
return !1;
|
|
160
|
+
},
|
|
161
|
+
[m, t]
|
|
162
|
+
), B = E(
|
|
163
|
+
(s) => {
|
|
164
|
+
const c = k(), d = b.current;
|
|
165
|
+
if (m && _(c) && c.getNodes().length === 1) {
|
|
166
|
+
if (u)
|
|
167
|
+
return $(null), s.preventDefault(), r.focus(), !0;
|
|
168
|
+
if (d !== null && d !== document.activeElement)
|
|
169
|
+
return s.preventDefault(), d.focus(), !0;
|
|
170
|
+
}
|
|
171
|
+
return !1;
|
|
172
|
+
},
|
|
173
|
+
[r, m, u]
|
|
174
|
+
), R = E(
|
|
175
|
+
(s) => T.current === r || b.current === s.target ? ($(null), l.update(() => {
|
|
176
|
+
o(!0);
|
|
177
|
+
const c = l.getRootElement();
|
|
178
|
+
c !== null && c.focus();
|
|
179
|
+
}), !0) : !1,
|
|
180
|
+
[r, l, o]
|
|
181
|
+
);
|
|
182
|
+
return P(() => {
|
|
183
|
+
let s = !0;
|
|
184
|
+
const c = W(
|
|
185
|
+
l.registerUpdateListener(({ editorState: d }) => {
|
|
186
|
+
s && L(d.read(() => k()));
|
|
187
|
+
}),
|
|
188
|
+
l.registerCommand(
|
|
189
|
+
Y,
|
|
190
|
+
(d, C) => (T.current = C, !1),
|
|
191
|
+
h
|
|
192
|
+
),
|
|
193
|
+
l.registerCommand(
|
|
194
|
+
X,
|
|
195
|
+
(d) => {
|
|
196
|
+
const C = d;
|
|
197
|
+
return C.target === f.current ? (C.shiftKey ? o(!m) : (S(), o(!0)), !0) : !1;
|
|
198
|
+
},
|
|
199
|
+
h
|
|
200
|
+
),
|
|
201
|
+
l.registerCommand(
|
|
202
|
+
V,
|
|
203
|
+
(d) => d.target === f.current ? (d.preventDefault(), !0) : !1,
|
|
204
|
+
h
|
|
205
|
+
),
|
|
206
|
+
l.registerCommand(
|
|
207
|
+
J,
|
|
208
|
+
y,
|
|
209
|
+
h
|
|
210
|
+
),
|
|
211
|
+
l.registerCommand(
|
|
212
|
+
H,
|
|
213
|
+
y,
|
|
214
|
+
h
|
|
215
|
+
),
|
|
216
|
+
l.registerCommand(G, B, h),
|
|
217
|
+
l.registerCommand(
|
|
218
|
+
z,
|
|
219
|
+
R,
|
|
220
|
+
h
|
|
221
|
+
)
|
|
222
|
+
);
|
|
223
|
+
return () => {
|
|
224
|
+
s = !1, c();
|
|
225
|
+
};
|
|
226
|
+
}, [
|
|
227
|
+
S,
|
|
228
|
+
l,
|
|
229
|
+
m,
|
|
230
|
+
t,
|
|
231
|
+
y,
|
|
232
|
+
B,
|
|
233
|
+
R,
|
|
234
|
+
o
|
|
235
|
+
]), /* @__PURE__ */ g(F, { fallback: null, children: [
|
|
236
|
+
/* @__PURE__ */ g(U, { children: [
|
|
237
|
+
/* @__PURE__ */ g("div", { draggable: !1, children: [
|
|
238
|
+
/* @__PURE__ */ e(
|
|
239
|
+
"button",
|
|
240
|
+
{
|
|
241
|
+
className: "image-edit-button",
|
|
242
|
+
ref: b,
|
|
243
|
+
onClick: () => {
|
|
244
|
+
w("Update Inline Image", (s) => /* @__PURE__ */ e(
|
|
245
|
+
ue,
|
|
246
|
+
{
|
|
247
|
+
activeEditor: l,
|
|
248
|
+
nodeKey: t,
|
|
249
|
+
onClose: s
|
|
250
|
+
}
|
|
251
|
+
));
|
|
252
|
+
},
|
|
253
|
+
children: "Edit"
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ e(
|
|
257
|
+
ce,
|
|
258
|
+
{
|
|
259
|
+
className: m ? `focused ${_(K) ? "draggable" : ""}` : null,
|
|
260
|
+
src: a,
|
|
261
|
+
altText: i,
|
|
262
|
+
imageRef: f,
|
|
263
|
+
width: n,
|
|
264
|
+
height: p,
|
|
265
|
+
position: N
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
] }),
|
|
269
|
+
u && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ g(le, { initialEditor: r, children: [
|
|
270
|
+
/* @__PURE__ */ e(Z, {}),
|
|
271
|
+
/* @__PURE__ */ e(ee, {}),
|
|
272
|
+
/* @__PURE__ */ e(
|
|
273
|
+
te,
|
|
274
|
+
{
|
|
275
|
+
contentEditable: /* @__PURE__ */ e(ne, { className: "InlineImageNode__contentEditable" }),
|
|
276
|
+
placeholder: /* @__PURE__ */ e(re, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
|
|
277
|
+
ErrorBoundary: ae
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
] }) })
|
|
281
|
+
] }),
|
|
282
|
+
v
|
|
283
|
+
] });
|
|
284
|
+
}
|
|
285
|
+
export {
|
|
286
|
+
ue as UpdateInlineImageDialog,
|
|
287
|
+
be as default
|
|
288
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ad as p, ae as E, I as k } from "./index-Bz8Yenv3.js";
|
|
2
|
+
import { useRef as C, useContext as K, useMemo as O, useEffect as m } from "react";
|
|
3
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
4
|
+
function D(e) {
|
|
5
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
6
|
+
}
|
|
7
|
+
var P = D(function(e) {
|
|
8
|
+
const t = new URLSearchParams();
|
|
9
|
+
t.append("code", e);
|
|
10
|
+
for (let s = 1; s < arguments.length; s++) t.append("v", arguments[s]);
|
|
11
|
+
throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
12
|
+
});
|
|
13
|
+
function h(e) {
|
|
14
|
+
const t = e.transform();
|
|
15
|
+
return t !== null ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
|
|
16
|
+
}
|
|
17
|
+
function j({ initialEditor: e, children: t, initialNodes: s, initialTheme: g, skipCollabChecks: v }) {
|
|
18
|
+
const f = C(!1), i = K(p);
|
|
19
|
+
i == null && P(9);
|
|
20
|
+
const [o, { getTheme: w }] = i, x = O(() => {
|
|
21
|
+
const l = g || w() || void 0, y = E(i, l);
|
|
22
|
+
if (l !== void 0 && (e._config.theme = l), e._parentEditor = o, s) for (let r of s) {
|
|
23
|
+
let a = null, n = null;
|
|
24
|
+
if (typeof r != "function") {
|
|
25
|
+
const d = r;
|
|
26
|
+
r = d.replace, a = d.with, n = d.withKlass || null;
|
|
27
|
+
}
|
|
28
|
+
const u = e._nodes.get(r.getType());
|
|
29
|
+
e._nodes.set(r.getType(), { exportDOM: u ? u.exportDOM : void 0, klass: r, replace: a, replaceWithKlass: n, transforms: h(r) });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const r = e._nodes = new Map(o._nodes);
|
|
33
|
+
for (const [a, n] of r) e._nodes.set(a, { exportDOM: n.exportDOM, klass: n.klass, replace: n.replace, replaceWithKlass: n.replaceWithKlass, transforms: h(n.klass) });
|
|
34
|
+
}
|
|
35
|
+
return e._config.namespace = o._config.namespace, e._editable = o._editable, [e, y];
|
|
36
|
+
}, []), { isCollabActive: M, yjsDocMap: b } = k(), c = v || f.current || b.has(e.getKey());
|
|
37
|
+
return m(() => {
|
|
38
|
+
c && (f.current = !0);
|
|
39
|
+
}, [c]), m(() => o.registerEditableListener((l) => {
|
|
40
|
+
e.setEditable(l);
|
|
41
|
+
}), [e, o]), _(p.Provider, { value: x, children: !M || c ? t : null });
|
|
42
|
+
}
|
|
43
|
+
function L({
|
|
44
|
+
children: e,
|
|
45
|
+
className: t
|
|
46
|
+
}) {
|
|
47
|
+
return /* @__PURE__ */ _("div", { className: t || "Placeholder__root", children: e });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
j as S,
|
|
51
|
+
L as W
|
|
52
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsx as l, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as y, useState as D, useRef as O, useCallback as L, useEffect as V } from "react";
|
|
3
|
+
import { s as $, d as w, x, L as C, u as b, v as k, c as E, i as S, g as v, Q as U, U as j, a as z, I as B, w as K } from "./index-Bz8Yenv3.js";
|
|
4
|
+
function I(...o) {
|
|
5
|
+
return o.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
function Q(o) {
|
|
8
|
+
return o.reduce((a, n) => a + n.votes.length, 0);
|
|
9
|
+
}
|
|
10
|
+
function R({
|
|
11
|
+
option: o,
|
|
12
|
+
index: a,
|
|
13
|
+
options: n,
|
|
14
|
+
totalVotes: i,
|
|
15
|
+
withPollNode: p
|
|
16
|
+
}) {
|
|
17
|
+
const { clientID: r } = B(), m = O(null), u = o.votes, h = u.indexOf(r) !== -1, c = u.length, N = o.text;
|
|
18
|
+
return /* @__PURE__ */ P("div", { className: "PollNode__optionContainer", children: [
|
|
19
|
+
/* @__PURE__ */ l(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: I(
|
|
23
|
+
"PollNode__optionCheckboxWrapper",
|
|
24
|
+
h && "PollNode__optionCheckboxChecked"
|
|
25
|
+
),
|
|
26
|
+
children: /* @__PURE__ */ l(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
ref: m,
|
|
30
|
+
className: "PollNode__optionCheckbox",
|
|
31
|
+
type: "checkbox",
|
|
32
|
+
onChange: () => {
|
|
33
|
+
p((s) => {
|
|
34
|
+
s.toggleVote(o, r);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
checked: h
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ P("div", { className: "PollNode__optionInputWrapper", children: [
|
|
43
|
+
/* @__PURE__ */ l(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: "PollNode__optionInputVotes",
|
|
47
|
+
style: { width: `${c === 0 ? 0 : c / i * 100}%` }
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ l("span", { className: "PollNode__optionInputVotesCount", children: c > 0 && (c === 1 ? "1 vote" : `${c} votes`) }),
|
|
51
|
+
/* @__PURE__ */ l(
|
|
52
|
+
"input",
|
|
53
|
+
{
|
|
54
|
+
className: "PollNode__optionInput",
|
|
55
|
+
type: "text",
|
|
56
|
+
value: N,
|
|
57
|
+
onChange: (s) => {
|
|
58
|
+
const d = s.target, f = d.value, g = d.selectionStart, e = d.selectionEnd;
|
|
59
|
+
p(
|
|
60
|
+
(t) => {
|
|
61
|
+
t.setOptionText(o, f);
|
|
62
|
+
},
|
|
63
|
+
() => {
|
|
64
|
+
d.selectionStart = g, d.selectionEnd = e;
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
placeholder: `Option ${a + 1}`
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ l(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
disabled: n.length < 3,
|
|
76
|
+
className: I(
|
|
77
|
+
"PollNode__optionDelete",
|
|
78
|
+
n.length < 3 && "PollNode__optionDeleteDisabled"
|
|
79
|
+
),
|
|
80
|
+
"aria-label": "Remove",
|
|
81
|
+
onClick: () => {
|
|
82
|
+
p((s) => {
|
|
83
|
+
s.deleteOption(o);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
function A({
|
|
91
|
+
question: o,
|
|
92
|
+
options: a,
|
|
93
|
+
nodeKey: n
|
|
94
|
+
}) {
|
|
95
|
+
const [i] = $(), p = y(() => Q(a), [a]), [r, m, u] = w(n), [h, c] = D(null), N = O(null), s = L(
|
|
96
|
+
(e) => {
|
|
97
|
+
if (r && x(C())) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
const t = b(n);
|
|
100
|
+
k(t) && t.remove();
|
|
101
|
+
}
|
|
102
|
+
return !1;
|
|
103
|
+
},
|
|
104
|
+
[r, n]
|
|
105
|
+
);
|
|
106
|
+
V(() => E(
|
|
107
|
+
i.registerUpdateListener(({ editorState: e }) => {
|
|
108
|
+
c(e.read(() => C()));
|
|
109
|
+
}),
|
|
110
|
+
i.registerCommand(
|
|
111
|
+
j,
|
|
112
|
+
(e) => {
|
|
113
|
+
const t = e;
|
|
114
|
+
return t.target === N.current ? (t.shiftKey || u(), m(!r), !0) : !1;
|
|
115
|
+
},
|
|
116
|
+
v
|
|
117
|
+
),
|
|
118
|
+
i.registerCommand(
|
|
119
|
+
U,
|
|
120
|
+
s,
|
|
121
|
+
v
|
|
122
|
+
),
|
|
123
|
+
i.registerCommand(
|
|
124
|
+
S,
|
|
125
|
+
s,
|
|
126
|
+
v
|
|
127
|
+
)
|
|
128
|
+
), [u, i, r, n, s, m]);
|
|
129
|
+
const d = (e, t) => {
|
|
130
|
+
i.update(
|
|
131
|
+
() => {
|
|
132
|
+
const _ = b(n);
|
|
133
|
+
k(_) && e(_);
|
|
134
|
+
},
|
|
135
|
+
{ onUpdate: t }
|
|
136
|
+
);
|
|
137
|
+
}, f = () => {
|
|
138
|
+
d((e) => {
|
|
139
|
+
e.addOption(K());
|
|
140
|
+
});
|
|
141
|
+
}, g = x(h) && r;
|
|
142
|
+
return /* @__PURE__ */ l(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: `PollNode__container ${g ? "focused" : ""}`,
|
|
146
|
+
ref: N,
|
|
147
|
+
children: /* @__PURE__ */ P("div", { className: "PollNode__inner", children: [
|
|
148
|
+
/* @__PURE__ */ l("h2", { className: "PollNode__heading", children: o }),
|
|
149
|
+
a.map((e, t) => {
|
|
150
|
+
const _ = e.uid;
|
|
151
|
+
return /* @__PURE__ */ l(
|
|
152
|
+
R,
|
|
153
|
+
{
|
|
154
|
+
withPollNode: d,
|
|
155
|
+
option: e,
|
|
156
|
+
index: t,
|
|
157
|
+
options: a,
|
|
158
|
+
totalVotes: p
|
|
159
|
+
},
|
|
160
|
+
_
|
|
161
|
+
);
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ l("div", { className: "PollNode__footer", children: /* @__PURE__ */ l(z, { onClick: f, small: !0, children: "Add Option" }) })
|
|
164
|
+
] })
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
A as default
|
|
170
|
+
};
|