@uva-glass/component-library 3.41.1 → 3.42.1
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/{Lexical.prod-7x3WP3vd.js → Lexical.prod-C1B_JvcI.js} +100 -99
- package/dist/Lexical.prod-C1B_JvcI.js.map +1 -0
- package/dist/{LexicalClipboard.prod-BMLLh6JL.js → LexicalClipboard.prod-Dd64YQH0.js} +10 -10
- package/dist/{LexicalClipboard.prod-BMLLh6JL.js.map → LexicalClipboard.prod-Dd64YQH0.js.map} +1 -1
- package/dist/{LexicalLink.prod-Dr6L083o.js → LexicalLink.prod-ldhpNY9X.js} +3 -3
- package/dist/{LexicalLink.prod-Dr6L083o.js.map → LexicalLink.prod-ldhpNY9X.js.map} +1 -1
- package/dist/{LexicalList.prod-nl__pKjG.js → LexicalList.prod-7DmvPZ_J.js} +4 -4
- package/dist/{LexicalList.prod-nl__pKjG.js.map → LexicalList.prod-7DmvPZ_J.js.map} +1 -1
- package/dist/{LexicalSelection.prod-CB_xP0pP.js → LexicalSelection.prod-Dmiwka3x.js} +5 -5
- package/dist/{LexicalSelection.prod-CB_xP0pP.js.map → LexicalSelection.prod-Dmiwka3x.js.map} +1 -1
- package/dist/{LexicalTable.prod-CwkGGOke.js → LexicalTable.prod-iqHmKv_G.js} +666 -625
- package/dist/LexicalTable.prod-iqHmKv_G.js.map +1 -0
- package/dist/LexicalUtils.prod-w0fZ_Z8S.js +123 -0
- package/dist/{LexicalUtils.prod-CtYaCJNB.js.map → LexicalUtils.prod-w0fZ_Z8S.js.map} +1 -1
- package/dist/RteEditor.module-dE9wQTC9.js +42 -0
- package/dist/RteEditor.module-dE9wQTC9.js.map +1 -0
- package/dist/TableCellResizerPlugin-D6jjhYoD.js +239 -0
- package/dist/TableCellResizerPlugin-D6jjhYoD.js.map +1 -0
- package/dist/TablePlugin-cMMBdz-x.js +306 -0
- package/dist/TablePlugin-cMMBdz-x.js.map +1 -0
- package/dist/assets/RteEditor.css +1 -1
- package/dist/assets/TableCellResizerPlugin.css +1 -0
- package/dist/components/CheckboxTree/CheckboxTree.js +9 -8
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/FormInput/FormInput.js +4 -3
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +4 -3
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -2
- package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +4 -3
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +4 -3
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +4 -3
- package/dist/components/RadioTabSelector/RadioTabSelector.js.map +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +4 -3
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +14 -13
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +5 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +26 -25
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +6 -6
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.d.ts +2 -0
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +13 -0
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +4 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +9 -6
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +9 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +73 -56
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +11 -9
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
- package/dist/components/RteEditor/Plugins/index.js +13 -9
- package/dist/components/RteEditor/Plugins/index.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +307 -319
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +2 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
- package/dist/components/RteEditor/helpers.d.ts +1 -0
- package/dist/components/RteEditor/helpers.js +22 -21
- package/dist/components/RteEditor/helpers.js.map +1 -1
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.d.ts +15 -0
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +69 -0
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -0
- package/dist/components/RteEditor/nodes/TableWrapperNode/index.d.ts +1 -0
- package/dist/components/RteEditor/nodes/TableWrapperNode/index.js +10 -0
- package/dist/components/RteEditor/nodes/TableWrapperNode/index.js.map +1 -0
- package/dist/components/RteEditor/nodes/index.d.ts +1 -0
- package/dist/components/RteEditor/nodes/index.js +10 -0
- package/dist/components/RteEditor/nodes/index.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/{helpers-B0VCD9f3.js → helpers-BO6Gg9y6.js} +4 -4
- package/dist/{helpers-B0VCD9f3.js.map → helpers-BO6Gg9y6.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/Lexical.prod-7x3WP3vd.js.map +0 -1
- package/dist/LexicalTable.prod-CwkGGOke.js.map +0 -1
- package/dist/LexicalUtils.prod-CtYaCJNB.js +0 -107
- package/dist/RteEditor.module-B_3uFnFu.js +0 -41
- package/dist/RteEditor.module-B_3uFnFu.js.map +0 -1
- package/dist/TablePlugin-DNGtPPjq.js +0 -301
- package/dist/TablePlugin-DNGtPPjq.js.map +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { jsx as y, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useState as x, useRef as E, useLayoutEffect as Z, useEffect as _, useCallback as b } from "react";
|
|
3
|
+
import { o as A } from "./LexicalComposerContext.prod-DLlRM5wP.js";
|
|
4
|
+
import { a as ee, R as Y, H as M, P as te, E as ne, h as oe, M as re, c as le } from "./LexicalTable.prod-iqHmKv_G.js";
|
|
5
|
+
import { M as K } from "./LexicalUtils.prod-w0fZ_Z8S.js";
|
|
6
|
+
import { T as W, k as se } from "./Lexical.prod-C1B_JvcI.js";
|
|
7
|
+
import { createPortal as ie } from "react-dom";
|
|
8
|
+
import { TableWrapperNode as ce, $createTableWrapperNode as ue } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
9
|
+
import './assets/TableCellResizerPlugin.css';const ae = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Z : _;
|
|
10
|
+
function de(l) {
|
|
11
|
+
return { initialValueFn: () => l.isEditable(), subscribe: (d) => l.registerEditableListener(d) };
|
|
12
|
+
}
|
|
13
|
+
function fe() {
|
|
14
|
+
return function(l) {
|
|
15
|
+
const [d] = A(), p = F(() => l(d), [d, l]), [m, h] = x(() => p.initialValueFn()), w = E(m);
|
|
16
|
+
return ae(() => {
|
|
17
|
+
const { initialValueFn: R, subscribe: c } = p, C = R();
|
|
18
|
+
return w.current !== C && (w.current = C, h(C)), c((z) => {
|
|
19
|
+
w.current = z, h(z);
|
|
20
|
+
});
|
|
21
|
+
}, [p, l]), m;
|
|
22
|
+
}(de);
|
|
23
|
+
}
|
|
24
|
+
const S = {
|
|
25
|
+
"table-cell-resizer__resizer": "_table-cell-resizer__resizer_2hhfo_17"
|
|
26
|
+
}, he = 33, $ = 32, B = 2;
|
|
27
|
+
function we({ editor: l }) {
|
|
28
|
+
const d = E(null), p = E(null), m = E(null), h = E(null), [w, R] = x(null), [c, C] = x(null), [z, T] = x(!1), [a, H] = x(null), v = b(() => {
|
|
29
|
+
C(null), d.current = null, H(null), h.current = null, m.current = null;
|
|
30
|
+
}, []), U = (e) => (e.buttons & 1) === 1;
|
|
31
|
+
_(() => l.registerNodeTransform(ee, (e) => {
|
|
32
|
+
if (!e.getColWidths()) {
|
|
33
|
+
const t = e.getChildren(), o = e.getColumnCount(), i = new Array(o).fill(void 0);
|
|
34
|
+
t[0].getChildren().forEach((n, u) => {
|
|
35
|
+
const f = l.getElementByKey(n.getKey());
|
|
36
|
+
f && f.style.width ? (i[u] = parseInt(f.style.width, 10), f.style.width = "") : i[u] = $;
|
|
37
|
+
}), e.setColWidths(i);
|
|
38
|
+
}
|
|
39
|
+
if (e && !(e.getParent() instanceof ce)) {
|
|
40
|
+
const t = ue();
|
|
41
|
+
e.replace(t), t.append(e);
|
|
42
|
+
}
|
|
43
|
+
return e;
|
|
44
|
+
}), [l]), _(() => {
|
|
45
|
+
const e = (s) => {
|
|
46
|
+
const r = s.target;
|
|
47
|
+
if (se(r)) {
|
|
48
|
+
if (a) {
|
|
49
|
+
R({
|
|
50
|
+
x: s.clientX,
|
|
51
|
+
y: s.clientY
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (T(U(s)), !(p.current && p.current.contains(r)) && d.current !== r) {
|
|
56
|
+
d.current = r;
|
|
57
|
+
const n = re(r);
|
|
58
|
+
n && c !== n ? l.getEditorState().read(
|
|
59
|
+
() => {
|
|
60
|
+
const u = W(n.elem);
|
|
61
|
+
if (!u)
|
|
62
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
63
|
+
const f = M(u), g = le(f, l.getElementByKey(f.getKey()));
|
|
64
|
+
if (!g)
|
|
65
|
+
throw new Error("TableCellResizer: Table element not found.");
|
|
66
|
+
d.current = r, m.current = g.getBoundingClientRect(), C(n);
|
|
67
|
+
},
|
|
68
|
+
{ editor: l }
|
|
69
|
+
) : n == null && v();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, t = () => {
|
|
73
|
+
T(!0);
|
|
74
|
+
}, o = () => {
|
|
75
|
+
T(!1);
|
|
76
|
+
}, i = l.registerRootListener((s, r) => {
|
|
77
|
+
r?.removeEventListener("mousemove", e), r?.removeEventListener("mousedown", t), r?.removeEventListener("mouseup", o), s?.addEventListener("mousemove", e), s?.addEventListener("mousedown", t), s?.addEventListener("mouseup", o);
|
|
78
|
+
});
|
|
79
|
+
return () => {
|
|
80
|
+
i();
|
|
81
|
+
};
|
|
82
|
+
}, [c, a, l, v]);
|
|
83
|
+
const L = (e) => e === "bottom", D = b(
|
|
84
|
+
(e) => {
|
|
85
|
+
if (!c)
|
|
86
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
87
|
+
l.update(
|
|
88
|
+
() => {
|
|
89
|
+
const t = W(c.elem);
|
|
90
|
+
if (!Y(t))
|
|
91
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
92
|
+
const o = M(t), i = te(t) + t.getRowSpan() - 1, s = o.getChildren();
|
|
93
|
+
if (i >= s.length || i < 0)
|
|
94
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
95
|
+
const r = s[i];
|
|
96
|
+
if (!ne(r))
|
|
97
|
+
throw new Error("Expected table row");
|
|
98
|
+
let n = r.getHeight();
|
|
99
|
+
if (n === void 0) {
|
|
100
|
+
const f = r.getChildren();
|
|
101
|
+
n = Math.min(...f.map((g) => V(g, l) ?? 1 / 0));
|
|
102
|
+
}
|
|
103
|
+
const u = Math.max(n + e, he);
|
|
104
|
+
r.setHeight(u);
|
|
105
|
+
},
|
|
106
|
+
{ tag: "skip-scroll-into-view" }
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
[c, l]
|
|
110
|
+
), V = (e, t) => t.getElementByKey(e.getKey())?.clientHeight, j = (e, t) => {
|
|
111
|
+
for (let o = 0; o < t.length; o++)
|
|
112
|
+
for (let i = 0; i < t[o].length; i++)
|
|
113
|
+
if (t[o][i].cell === e)
|
|
114
|
+
return i;
|
|
115
|
+
return -1;
|
|
116
|
+
}, N = b(
|
|
117
|
+
(e) => {
|
|
118
|
+
if (!c)
|
|
119
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
120
|
+
l.update(
|
|
121
|
+
() => {
|
|
122
|
+
const t = W(c.elem);
|
|
123
|
+
if (!Y(t))
|
|
124
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
125
|
+
const o = M(t), [i] = oe(o, null, null), s = j(t, i);
|
|
126
|
+
if (s === void 0)
|
|
127
|
+
throw new Error("TableCellResizer: Table column not found.");
|
|
128
|
+
const r = o.getColWidths();
|
|
129
|
+
if (!r)
|
|
130
|
+
return;
|
|
131
|
+
const n = r[s];
|
|
132
|
+
if (n === void 0)
|
|
133
|
+
return;
|
|
134
|
+
const u = [...r], f = Math.max(n + e, $);
|
|
135
|
+
if (u[s] = f, o.setColWidths(u), s < o.getColumnCount() - 1) {
|
|
136
|
+
const g = o.getColWidths();
|
|
137
|
+
if (!g)
|
|
138
|
+
return;
|
|
139
|
+
const k = [...g], X = s + 1, G = g[X], q = Math.max(G - e, $);
|
|
140
|
+
k[X] = q, o.setColWidths(k);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{ tag: "skip-scroll-into-view" }
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
[c, l]
|
|
147
|
+
), O = b(
|
|
148
|
+
(e) => {
|
|
149
|
+
const t = (o) => {
|
|
150
|
+
if (o.preventDefault(), o.stopPropagation(), !c)
|
|
151
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
152
|
+
if (h.current) {
|
|
153
|
+
const { x: i, y: s } = h.current;
|
|
154
|
+
if (c === null)
|
|
155
|
+
return;
|
|
156
|
+
const r = K(o.target);
|
|
157
|
+
if (L(e)) {
|
|
158
|
+
const n = (o.clientY - s) / r;
|
|
159
|
+
D(n);
|
|
160
|
+
} else {
|
|
161
|
+
const n = (o.clientX - i) / r;
|
|
162
|
+
N(n);
|
|
163
|
+
}
|
|
164
|
+
v(), document.removeEventListener("mouseup", t);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
return t;
|
|
168
|
+
},
|
|
169
|
+
[c, v, N, D]
|
|
170
|
+
), I = b(
|
|
171
|
+
(e) => (t) => {
|
|
172
|
+
if (t.preventDefault(), t.stopPropagation(), !c)
|
|
173
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
174
|
+
h.current = {
|
|
175
|
+
x: t.clientX,
|
|
176
|
+
y: t.clientY
|
|
177
|
+
}, R(h.current), H(e), document.addEventListener("mouseup", O(e));
|
|
178
|
+
},
|
|
179
|
+
[c, O]
|
|
180
|
+
), P = b(() => {
|
|
181
|
+
if (c) {
|
|
182
|
+
const { height: e, width: t, top: o, left: i } = c.elem.getBoundingClientRect(), s = K(c.elem), r = 10, n = {
|
|
183
|
+
bottom: {
|
|
184
|
+
backgroundColor: "none",
|
|
185
|
+
cursor: "ns-resize",
|
|
186
|
+
height: `${r}px`,
|
|
187
|
+
left: `${window.pageXOffset + i}px`,
|
|
188
|
+
top: `${window.pageYOffset + o + e - r / B}px`,
|
|
189
|
+
width: `${t}px`
|
|
190
|
+
},
|
|
191
|
+
right: {
|
|
192
|
+
backgroundColor: "none",
|
|
193
|
+
cursor: "ew-resize",
|
|
194
|
+
height: `${e}px`,
|
|
195
|
+
left: `${window.pageXOffset + i + t - r / B}px`,
|
|
196
|
+
top: `${window.pageYOffset + o}px`,
|
|
197
|
+
width: `${r}px`
|
|
198
|
+
}
|
|
199
|
+
}, u = m.current;
|
|
200
|
+
return a && w && u && (L(a) ? (n[a].left = `${window.pageXOffset + u.left}px`, n[a].top = `${window.pageYOffset + w.y / s}px`, n[a].height = "3px", n[a].width = `${u.width}px`) : (n[a].top = `${window.pageYOffset + u.top}px`, n[a].left = `${window.pageXOffset + w.x / s}px`, n[a].width = "3px", n[a].height = `${u.height}px`), n[a].backgroundColor = "#adf"), n;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
bottom: null,
|
|
204
|
+
left: null,
|
|
205
|
+
right: null,
|
|
206
|
+
top: null
|
|
207
|
+
};
|
|
208
|
+
}, [c, a, w])();
|
|
209
|
+
return /* @__PURE__ */ y("div", { ref: p, children: c != null && !z && /* @__PURE__ */ J(Q, { children: [
|
|
210
|
+
/* @__PURE__ */ y(
|
|
211
|
+
"div",
|
|
212
|
+
{
|
|
213
|
+
className: S["table-cell-resizer__resizer"],
|
|
214
|
+
style: P.right || void 0,
|
|
215
|
+
onMouseDown: I("right")
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ y(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
className: S["table-cell-resizer__resizer"],
|
|
222
|
+
style: P.bottom || void 0,
|
|
223
|
+
onMouseDown: I("bottom")
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] }) });
|
|
227
|
+
}
|
|
228
|
+
const ve = () => {
|
|
229
|
+
const [l] = A(), d = fe();
|
|
230
|
+
return F(
|
|
231
|
+
() => d ? ie(/* @__PURE__ */ y(we, { editor: l }), document.body) : null,
|
|
232
|
+
[l, d]
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
export {
|
|
236
|
+
ve as T,
|
|
237
|
+
fe as a
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=TableCellResizerPlugin-D6jjhYoD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCellResizerPlugin-D6jjhYoD.js","sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i((()=>n(t)),[t,n]),[a,l]=r((()=>u.initialValueFn())),d=o(a);return c((()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n((e=>{d.current=e,l(e)}))}),[u,n]),a}(u)}export{a as useLexicalEditable};\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n} from '@lexical/table';\r\nimport { calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableCellNode, TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"names":["c","n","t","u","e","a","i","l","r","d","o","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","HALF","TableCellResizer","editor","targetRef","useRef","resizerRef","tableRectRef","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","useState","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","useCallback","isMouseDownOnEvent","event","useEffect","TableNode","tableNode","tableRows","columnCount","colWidths","cell","colIdx","domCell","TableWrapperNode","wrapperNode","$createTableWrapperNode","onMouseMove","target","isHTMLElement","getDOMCellFromTarget","tableCellNode","$getNearestNodeFromDOMNode","$getTableNodeFromLexicalNodeOrThrow","tableElement","getTableElement","onMouseDown","onMouseUp","removeRootListener","rootElement","prevRootElement","isHeightChanging","direction","updateRowHeight","heightChange","$isTableCellNode","tableRowIndex","$getTableRowIndexFromTableCellNode","tableRow","$isTableRowNode","height","rowCells","getCellNodeHeight","newHeight","activeEditor","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","$computeTableMapSkipCellCheck","columnIndex","width","newColWidths","newWidth","nextColWidths","newNextColWidths","newColumnIndex","newNextWidth","nextWidth","mouseUpHandler","handler","x","y","zoom","calculateZoomLevel","toggleResize","resizerStyles","top","left","zoneWidth","styles","tableRect","jsx","jsxs","Fragment","TableCellResizerPlugin","useLexicalComposerContext","isEditable","useLexicalEditable","useMemo","createPortal"],"mappings":";;;;;;;;AAQgL,MAAMA,KAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,UAAmC,OAAO,SAAS,kBAAzB,SAAuCC,IAAEC;AAAE,SAASC,GAAEC,GAAE;AAAC,SAAM,EAAC,gBAAe,MAAIA,EAAE,WAAU,GAAG,WAAU,CAAAH,MAAGG,EAAE,yBAAyBH,CAAC,EAAC;AAAC;AAAC,SAASI,KAAG;AAAC,SAAO,SAASJ,GAAE;AAAC,UAAK,CAACC,CAAC,IAAEE,EAAC,GAAGD,IAAEG,EAAG,MAAIL,EAAEC,CAAC,GAAG,CAACA,GAAED,CAAC,CAAC,GAAE,CAACI,GAAEE,CAAC,IAAEC,EAAG,MAAIL,EAAE,eAAc,CAAE,GAAGM,IAAEC,EAAEL,CAAC;AAAE,WAAOL,GAAG,MAAI;AAAC,YAAK,EAAC,gBAAeI,GAAE,WAAUH,EAAC,IAAEE,GAAED,IAAEE;AAAI,aAAOK,EAAE,YAAUP,MAAIO,EAAE,UAAQP,GAAEK,EAAEL,CAAC,IAAGD,EAAG,CAAAG,MAAG;AAAC,QAAAK,EAAE,UAAQL,GAAEG,EA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L,MAAOF,IAAaG,GAAa,gBAAAR,EAACzF,MAAiB,QAAAC,EAAA,CAAgB,GAAI,SAAS,IAAI,IAAI;AAAA,IACxF,CAACA,GAAQ6F,CAAU;AAAA,EAAA;AAEvB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { o as ee } from "./LexicalComposerContext.prod-DLlRM5wP.js";
|
|
3
|
+
import { c as z } from "./clsx-OuTLNxxd.js";
|
|
4
|
+
import { W as te, R as oe, y as re } from "./LexicalTable.prod-iqHmKv_G.js";
|
|
5
|
+
import { as as le, J as ne, P as J, _ as O, y as ie, ah as ae } from "./Lexical.prod-C1B_JvcI.js";
|
|
6
|
+
import { v as se } from "./LexicalUtils.prod-w0fZ_Z8S.js";
|
|
7
|
+
import { forwardRef as V, useState as C, useRef as g, useId as A, useImperativeHandle as K, useEffect as R } from "react";
|
|
8
|
+
import "./components/Accordion/Accordion.js";
|
|
9
|
+
import { Button as I } from "./components/Buttons/Button.js";
|
|
10
|
+
import "./components/Buttons/LinkButton.js";
|
|
11
|
+
import "@react-aria/button";
|
|
12
|
+
import "./components/Checkbox/Checkbox.js";
|
|
13
|
+
import { Label as S } from "./components/Label/Label.js";
|
|
14
|
+
import "@react-aria/dialog";
|
|
15
|
+
import "@react-aria/focus";
|
|
16
|
+
import "@react-aria/overlays";
|
|
17
|
+
import "./components/OverlayCloseButton/OverlayCloseButton.js";
|
|
18
|
+
import { FormField as H } from "./components/FormField/FormField.js";
|
|
19
|
+
import "./components/GridRow/GridRow.js";
|
|
20
|
+
import "./components/IconButton/IconButton.js";
|
|
21
|
+
import "./components/Input/Input.js";
|
|
22
|
+
import { InputField as U } from "./components/InputField/InputField.js";
|
|
23
|
+
import "react-router";
|
|
24
|
+
import { s as L, M as ce } from "./MultiSelectItem-DbOdEllV.js";
|
|
25
|
+
import "./components/RteEditor/Providers/LanguageProvider.js";
|
|
26
|
+
import { e as me, v as de } from "./helpers-BO6Gg9y6.js";
|
|
27
|
+
import { Icon as G } from "./components/Icon/Icon.js";
|
|
28
|
+
import { FeedbackBox as Y } from "./components/FeedbackBox/FeedbackBox.js";
|
|
29
|
+
import { useTranslation as j } from "./components/RteEditor/hooks/useTranslation.js";
|
|
30
|
+
import "./components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
31
|
+
import "./components/RteEditor/hooks/components/Flyout.js";
|
|
32
|
+
import { PREVENT_OPEN_DELAY as ue, deleteTable as fe, deleteColumn as pe, insertColumn as _e, deleteRow as be, insertRow as he, createTable as ke, getEditorParrentCellWidth as ve, getEditorContentWidth as we, DEFAULT_EDITOR_WIDTH as Fe, DEFAULT_COL_WIDTH as ye } from "./components/RteEditor/Plugins/TablePlugin/helpers.js";
|
|
33
|
+
import { $createTableWrapperNode as Ce } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
34
|
+
import { useFlyout as Ne } from "./components/RteEditor/hooks/useFlyout.js";
|
|
35
|
+
import { s as M } from "./RteEditor.module-dE9wQTC9.js";
|
|
36
|
+
import "react-dom";
|
|
37
|
+
import "./index-nrPtQ1dv.js";
|
|
38
|
+
import "./components/SelectListbox/SelectListbox.js";
|
|
39
|
+
import "./components/SelectListbox/SelectProvider.js";
|
|
40
|
+
import "./components/Sortable/components/SortableItem.js";
|
|
41
|
+
import "./SortableProvider-l8-7ClBJ.js";
|
|
42
|
+
import { setScrollableContainers as xe, removeScrollableContainers as Te } from "./components/RteEditor/helpers.js";
|
|
43
|
+
import './assets/TablePlugin.css';function ge({ label: b, clearTrigger: u, onClear: a }) {
|
|
44
|
+
return /* @__PURE__ */ c("header", { className: L["multi-select__header"], children: [
|
|
45
|
+
/* @__PURE__ */ e(S, { htmlFor: "multi-select-list", children: b }),
|
|
46
|
+
u && /* @__PURE__ */ e(I, { variant: "blank", onClick: a, children: u })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
const Q = ({ scrollable: b = !0, noBorder: u, header: a, children: o }) => /* @__PURE__ */ c(Z, { children: [
|
|
50
|
+
a,
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: z(L["multi-select"], {
|
|
55
|
+
[L["multi-select--no-border"]]: u
|
|
56
|
+
}),
|
|
57
|
+
children: /* @__PURE__ */ e(
|
|
58
|
+
"ul",
|
|
59
|
+
{
|
|
60
|
+
className: z(L["multi-select__list"], {
|
|
61
|
+
[L["multi-select__list--scrollable"]]: b
|
|
62
|
+
}),
|
|
63
|
+
id: "multi-select-list",
|
|
64
|
+
children: o
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] });
|
|
70
|
+
Q.MultiSelectHeader = ge;
|
|
71
|
+
Q.MultiSelectItem = ce;
|
|
72
|
+
const Ee = "_linkform_ki2qx_1", Re = "_linkform__footer_ki2qx_12", T = {
|
|
73
|
+
linkform: Ee,
|
|
74
|
+
"linkform__input-field": "_linkform__input-field_ki2qx_5",
|
|
75
|
+
linkform__footer: Re,
|
|
76
|
+
"linkform__input-url-wrapper": "_linkform__input-url-wrapper_ki2qx_19",
|
|
77
|
+
"linkform__open-url-button": "_linkform__open-url-button_ki2qx_31"
|
|
78
|
+
}, Ft = V(
|
|
79
|
+
({ onCloseHandler: b, onSaveHandler: u, isLink: a = { active: !1, url: "", linktext: "" } }, o) => {
|
|
80
|
+
const l = j(), [f, m] = C(a.url || ""), [s, h] = C(a.linktext || ""), [F, k] = C(!1), [y, v] = C(null), [w, p] = C(null), n = g(null), N = `link_${A()}`, t = `text_${A()}`, r = () => {
|
|
81
|
+
window.open(me(f), "_blank");
|
|
82
|
+
}, _ = (i) => {
|
|
83
|
+
m(i.target.value);
|
|
84
|
+
}, d = (i) => {
|
|
85
|
+
h(i.target.value);
|
|
86
|
+
}, D = (i) => de(i) === !1 || i.trim() === "" ? (v(l.errortext.urlNotValid), !1) : (v(null), !0), W = (i) => i.trim() === "" ? (p(l.errortext.linkTextNotValid), !1) : (p(null), !0), $ = () => {
|
|
87
|
+
!D(f) || F && !W(s) || (u(f, s), E());
|
|
88
|
+
}, B = () => {
|
|
89
|
+
b(), E();
|
|
90
|
+
}, E = () => {
|
|
91
|
+
m(""), k(!1), v(null), p(null);
|
|
92
|
+
}, x = (i, X) => {
|
|
93
|
+
m(i), !X && !i && k(!0);
|
|
94
|
+
}, P = () => {
|
|
95
|
+
n.current && n.current.focus();
|
|
96
|
+
};
|
|
97
|
+
return K(o, () => ({
|
|
98
|
+
clearForm: E,
|
|
99
|
+
focusFirstField: P,
|
|
100
|
+
setDefaults: x
|
|
101
|
+
})), /* @__PURE__ */ c("div", { className: T.linkform, children: [
|
|
102
|
+
/* @__PURE__ */ c(H, { className: T["linkform__input-field"], children: [
|
|
103
|
+
/* @__PURE__ */ e(S, { htmlFor: N, children: l.links.linkLabel }),
|
|
104
|
+
/* @__PURE__ */ c("div", { className: T["linkform__input-url-wrapper"], children: [
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
U,
|
|
107
|
+
{
|
|
108
|
+
id: N,
|
|
109
|
+
placeholder: l.links.linkPlaceholder,
|
|
110
|
+
value: f,
|
|
111
|
+
onChange: (i) => _(i),
|
|
112
|
+
onFocus: () => v(null),
|
|
113
|
+
ref: n,
|
|
114
|
+
"aria-label": l.aria.labels.linkField
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
f && /* @__PURE__ */ e("button", { type: "button", onClick: r, className: T["linkform__open-url-button"], children: /* @__PURE__ */ e(G, { name: "ArrowTopRightOnSquare", size: 20 }) })
|
|
118
|
+
] }),
|
|
119
|
+
y && /* @__PURE__ */ e(Y, { level: "error", feedback: y })
|
|
120
|
+
] }),
|
|
121
|
+
F && /* @__PURE__ */ c(H, { className: T["linkform__input-field"], children: [
|
|
122
|
+
/* @__PURE__ */ e(S, { htmlFor: t, children: l.links.linkText }),
|
|
123
|
+
/* @__PURE__ */ e(
|
|
124
|
+
U,
|
|
125
|
+
{
|
|
126
|
+
id: t,
|
|
127
|
+
value: s,
|
|
128
|
+
onChange: (i) => d(i),
|
|
129
|
+
onFocus: () => p(null),
|
|
130
|
+
"aria-label": l.aria.labels.linkTextfield
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
w && /* @__PURE__ */ e(Y, { level: "error", feedback: w })
|
|
134
|
+
] }),
|
|
135
|
+
/* @__PURE__ */ c("div", { className: T.linkform__footer, children: [
|
|
136
|
+
/* @__PURE__ */ e(I, { variant: "secondary", onClick: B, "aria-label": l.common.cancel, type: "button", children: l.common.cancel }),
|
|
137
|
+
/* @__PURE__ */ e(I, { variant: "primary", onClick: $, "aria-label": l.aria.labels.linkOkButton, type: "button", children: l.links.addLink })
|
|
138
|
+
] })
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
), Le = "_tableform_t5fpq_1", Ie = "_tableform__footer_t5fpq_12", q = {
|
|
142
|
+
tableform: Le,
|
|
143
|
+
"tableform__input-field": "_tableform__input-field_t5fpq_5",
|
|
144
|
+
tableform__footer: Ie
|
|
145
|
+
}, Se = V(({ onCloseHandler: b, onSaveHandler: u }, a) => {
|
|
146
|
+
const o = j(), [l, f] = C(), [m, s] = C(), h = g(null), F = `row_${A()}`, k = `column_${A()}`, y = (n, N) => {
|
|
147
|
+
const t = n.target.value;
|
|
148
|
+
N === "row" ? f(parseInt(t)) : s(parseInt(t));
|
|
149
|
+
}, v = () => {
|
|
150
|
+
l !== void 0 && m !== void 0 && (u(l, m), p());
|
|
151
|
+
}, w = () => {
|
|
152
|
+
b(), p();
|
|
153
|
+
}, p = () => {
|
|
154
|
+
f(void 0), s(void 0);
|
|
155
|
+
};
|
|
156
|
+
return K(a, () => ({
|
|
157
|
+
clearForm: p,
|
|
158
|
+
focusFirstField: () => h.current?.focus()
|
|
159
|
+
})), R(() => {
|
|
160
|
+
const n = () => {
|
|
161
|
+
w();
|
|
162
|
+
};
|
|
163
|
+
return xe(n), window.addEventListener("scroll", n), window.addEventListener("resize", n), () => {
|
|
164
|
+
window.removeEventListener("scroll", n), window.removeEventListener("resize", n), Te(n);
|
|
165
|
+
};
|
|
166
|
+
}, []), /* @__PURE__ */ c("div", { className: q.tableform, children: [
|
|
167
|
+
/* @__PURE__ */ c(H, { className: q["tableform__input-field"], children: [
|
|
168
|
+
/* @__PURE__ */ e(S, { htmlFor: F, children: o.table.nrofRows }),
|
|
169
|
+
/* @__PURE__ */ e(
|
|
170
|
+
U,
|
|
171
|
+
{
|
|
172
|
+
id: F,
|
|
173
|
+
placeholder: o.table.nrofRowsPlaceholder,
|
|
174
|
+
value: l || "",
|
|
175
|
+
onChange: (n) => y(n, "row"),
|
|
176
|
+
"aria-label": o.aria.labels.tableRowfield,
|
|
177
|
+
ref: h
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ c(H, { className: q["tableform__input-field"], children: [
|
|
182
|
+
/* @__PURE__ */ e(S, { htmlFor: k, children: o.table.nrofColumns }),
|
|
183
|
+
/* @__PURE__ */ e(
|
|
184
|
+
U,
|
|
185
|
+
{
|
|
186
|
+
id: k,
|
|
187
|
+
placeholder: o.table.nrofColumnsPlaceholder,
|
|
188
|
+
value: m || "",
|
|
189
|
+
onChange: (n) => y(n, "column"),
|
|
190
|
+
"aria-label": o.aria.labels.tableColumnfield
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ c("div", { className: q.tableform__footer, children: [
|
|
195
|
+
/* @__PURE__ */ e(I, { variant: "secondary", onClick: w, "aria-label": o.common.cancel, children: o.common.cancel }),
|
|
196
|
+
/* @__PURE__ */ e(
|
|
197
|
+
I,
|
|
198
|
+
{
|
|
199
|
+
variant: "primary",
|
|
200
|
+
onClick: v,
|
|
201
|
+
disabled: !l || !m,
|
|
202
|
+
"aria-label": o.aria.labels.tableOkButton,
|
|
203
|
+
children: o.common.add
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] })
|
|
207
|
+
] });
|
|
208
|
+
}), yt = V(({ isActive: b }, u) => {
|
|
209
|
+
const a = j(), [o] = ee(), { flyout: l, showFlyout: f, hideFlyout: m, isVisible: s } = Ne(), h = g(void 0), F = g(null), k = g(!1), y = g(s), v = () => {
|
|
210
|
+
const t = F.current?.getBoundingClientRect();
|
|
211
|
+
!k.current && t && f({ position: { top: t.bottom, left: t.left }, ...N });
|
|
212
|
+
}, w = () => {
|
|
213
|
+
m();
|
|
214
|
+
}, p = (t, r) => {
|
|
215
|
+
o.update(() => {
|
|
216
|
+
const _ = J(), d = ke(t, r), D = O(_) && _.anchor.getNode() || ie(_) && _.getNodes()[0] || null, W = D ? se(D, re) : null, $ = W ? ve(W, r, o) : we(o) || Fe, B = Math.max(ye, Math.floor($ / Math.max(1, r))), E = Array.from({ length: r }, () => B);
|
|
217
|
+
d.setColWidths(E);
|
|
218
|
+
const x = Ce();
|
|
219
|
+
x.append(d), O(_) ? _.insertNodes([x]) : ae().append(x);
|
|
220
|
+
const P = x.getFirstDescendant();
|
|
221
|
+
P && P.select();
|
|
222
|
+
}), w();
|
|
223
|
+
}, n = (t) => {
|
|
224
|
+
o.update(() => {
|
|
225
|
+
const r = J();
|
|
226
|
+
if (O(r)) {
|
|
227
|
+
const _ = r.anchor.getNode(), d = te(_);
|
|
228
|
+
if (oe(d))
|
|
229
|
+
switch (t) {
|
|
230
|
+
case "insertRowAbove":
|
|
231
|
+
case "insertRowBelow":
|
|
232
|
+
he(d, t);
|
|
233
|
+
break;
|
|
234
|
+
case "deleteRow":
|
|
235
|
+
be(d);
|
|
236
|
+
break;
|
|
237
|
+
case "insertColumnLeft":
|
|
238
|
+
case "insertColumnRight":
|
|
239
|
+
_e(d, t);
|
|
240
|
+
break;
|
|
241
|
+
case "deleteColumn":
|
|
242
|
+
pe(d);
|
|
243
|
+
break;
|
|
244
|
+
case "deleteTable":
|
|
245
|
+
fe(d);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}, N = {
|
|
251
|
+
children: /* @__PURE__ */ e(
|
|
252
|
+
Se,
|
|
253
|
+
{
|
|
254
|
+
onCloseHandler: w,
|
|
255
|
+
onSaveHandler: (t, r) => p(t, r),
|
|
256
|
+
ref: h
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
};
|
|
260
|
+
return R(() => {
|
|
261
|
+
s ? (k.current = !0, h.current?.focusFirstField()) : (h.current?.clearForm(), setTimeout(() => k.current = !1, ue));
|
|
262
|
+
}, [h, s]), R(() => {
|
|
263
|
+
const t = o.registerCommand(
|
|
264
|
+
le,
|
|
265
|
+
(r) => r.ctrlKey && r.shiftKey && r.code === "Digit9" ? (r.preventDefault(), v(), !0) : !1,
|
|
266
|
+
ne
|
|
267
|
+
);
|
|
268
|
+
return () => {
|
|
269
|
+
t();
|
|
270
|
+
};
|
|
271
|
+
}, [o]), R(() => {
|
|
272
|
+
y.current = s;
|
|
273
|
+
}, [s]), R(() => {
|
|
274
|
+
const t = (r) => {
|
|
275
|
+
r.key === "Escape" && y.current && (r.preventDefault(), r.stopPropagation(), w());
|
|
276
|
+
};
|
|
277
|
+
return document.addEventListener("keydown", t, { capture: !0 }), () => {
|
|
278
|
+
document.removeEventListener("keydown", t);
|
|
279
|
+
};
|
|
280
|
+
}, []), K(u, () => ({
|
|
281
|
+
mutateTable: n
|
|
282
|
+
})), /* @__PURE__ */ e("div", { className: M["editor__toolbar-button-group"], children: /* @__PURE__ */ c("div", { className: M["editor__toolbar-button-flyoutwrapper"], children: [
|
|
283
|
+
/* @__PURE__ */ e(
|
|
284
|
+
"button",
|
|
285
|
+
{
|
|
286
|
+
onClick: v,
|
|
287
|
+
title: a.table.tableTooltip,
|
|
288
|
+
className: z(M["editor__toolbar-button"], b && M["editor__toolbar-button--active"]),
|
|
289
|
+
"aria-label": a.aria.labels.table,
|
|
290
|
+
"aria-keyshortcuts": a.aria.keyshortcuts.table,
|
|
291
|
+
ref: F,
|
|
292
|
+
type: "button",
|
|
293
|
+
children: /* @__PURE__ */ e(G, { name: "Table", size: 24 })
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
l
|
|
297
|
+
] }) });
|
|
298
|
+
});
|
|
299
|
+
export {
|
|
300
|
+
Ft as A,
|
|
301
|
+
Q as M,
|
|
302
|
+
yt as T,
|
|
303
|
+
ge as a,
|
|
304
|
+
Se as b
|
|
305
|
+
};
|
|
306
|
+
//# sourceMappingURL=TablePlugin-cMMBdz-x.js.map
|