@uva-glass/component-library 3.42.2 → 3.42.4
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-C1B_JvcI.js → Lexical.prod-qYl_ifJ6.js} +221 -221
- package/dist/Lexical.prod-qYl_ifJ6.js.map +1 -0
- package/dist/{LexicalClipboard.prod-Dd64YQH0.js → LexicalClipboard.prod-DIGbXq4v.js} +25 -25
- package/dist/{LexicalClipboard.prod-Dd64YQH0.js.map → LexicalClipboard.prod-DIGbXq4v.js.map} +1 -1
- package/dist/{LexicalComposerContext.prod-DLlRM5wP.js → LexicalComposerContext.prod-DOyoZx0P.js} +3 -3
- package/dist/{LexicalComposerContext.prod-DLlRM5wP.js.map → LexicalComposerContext.prod-DOyoZx0P.js.map} +1 -1
- package/dist/{LexicalLink.prod-ldhpNY9X.js → LexicalLink.prod-ZZwC5ABn.js} +14 -14
- package/dist/{LexicalLink.prod-ldhpNY9X.js.map → LexicalLink.prod-ZZwC5ABn.js.map} +1 -1
- package/dist/{LexicalList.prod-7DmvPZ_J.js → LexicalList.prod-UurCu6DK.js} +30 -30
- package/dist/{LexicalList.prod-7DmvPZ_J.js.map → LexicalList.prod-UurCu6DK.js.map} +1 -1
- package/dist/{LexicalSelection.prod-Dmiwka3x.js → LexicalSelection.prod-DXruZeFN.js} +2 -2
- package/dist/{LexicalSelection.prod-Dmiwka3x.js.map → LexicalSelection.prod-DXruZeFN.js.map} +1 -1
- package/dist/{LexicalTable.prod-iqHmKv_G.js → LexicalTable.prod-COFf1Spn.js} +115 -115
- package/dist/{LexicalTable.prod-iqHmKv_G.js.map → LexicalTable.prod-COFf1Spn.js.map} +1 -1
- package/dist/{LexicalUtils.prod-w0fZ_Z8S.js → LexicalUtils.prod-C3To3vrm.js} +5 -5
- package/dist/{LexicalUtils.prod-w0fZ_Z8S.js.map → LexicalUtils.prod-C3To3vrm.js.map} +1 -1
- package/dist/SortableProvider-l8-7ClBJ.js.map +1 -1
- package/dist/TableCellResizerPlugin-B9MT1fxA.js +248 -0
- package/dist/TableCellResizerPlugin-B9MT1fxA.js.map +1 -0
- package/dist/{TablePlugin-cMMBdz-x.js → TablePlugin-FQQwnq2m.js} +7 -7
- package/dist/{TablePlugin-cMMBdz-x.js.map → TablePlugin-FQQwnq2m.js.map} +1 -1
- package/dist/{client-BIzWgcD3.js → client-BK9NlSVR.js} +13 -13
- package/dist/{client-BIzWgcD3.js.map → client-BK9NlSVR.js.map} +1 -1
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/Accordion/Accordion.test.js.map +1 -1
- package/dist/components/AccordionCard/AccordionCard.js.map +1 -1
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js.map +1 -1
- package/dist/components/ActionList/ActionList.js.map +1 -1
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js.map +1 -1
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/AppStatusBar/AppStatusBar.test.js.map +1 -1
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Attention/Attention.test.js.map +1 -1
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js.map +1 -1
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/Button.test.js.map +1 -1
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/LinkButton.test.js.map +1 -1
- package/dist/components/Buttons/MenuButton.stories.js +1 -1
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.test.js.map +1 -1
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Card/Card.test.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/Checkbox/Checkbox.test.js.map +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js.map +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/ControlsButton/ControlsButton.stories.js +1 -1
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.js.map +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/FeedbackBar/FeedbackBar.test.js.map +1 -1
- package/dist/components/FormInput/FormInput.js +2 -2
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/FormInput/FormInput.stories.js +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +3 -3
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/Label/Label.test.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.js.map +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js.map +1 -1
- package/dist/components/Notification/Notification.js.map +1 -1
- package/dist/components/Notification/Notification.stories.js +1 -1
- package/dist/components/Notification/Notification.test.js +2 -2
- package/dist/components/Notification/Notification.test.js.map +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.js.map +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js.map +1 -1
- package/dist/components/PageOverlay/PageOverlay.js.map +1 -1
- package/dist/components/PageOverlay/PageOverlay.stories.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/RadioGroup/Radiogroup.test.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +6 -6
- 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 +4 -4
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +7 -6
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +6 -6
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +2 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +39 -29
- 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 +5 -5
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/Providers/LanguageProvider.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +149 -149
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +32 -34
- package/dist/components/RteEditor/helpers.js.map +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +4 -4
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -1
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/SelectProvider.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectButton.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectContainer.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectOption.js.map +1 -1
- package/dist/components/Sortable/Sortable.stories.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js.map +1 -1
- package/dist/components/Sortable/sortableReducer.js.map +1 -1
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/StatusBadge/StatusBadge.test.js.map +1 -1
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +3 -3
- package/dist/components/TextArea/TextArea.test.js.map +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/components/VarIndicator/VarIndicator.test.js.map +1 -1
- package/dist/components/hooks/useDebounce.js +2 -2
- package/dist/components/hooks/useDebounce.js.map +1 -1
- package/dist/components/hooks/useOnClickOutside.js.map +1 -1
- package/dist/components/hooks/usePositionedFloaters.js.map +1 -1
- package/dist/components/hooks/useResponsive.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BO6Gg9y6.js → helpers-D3SODeVc.js} +19 -19
- package/dist/{helpers-BO6Gg9y6.js.map → helpers-D3SODeVc.js.map} +1 -1
- package/dist/{index-BwBhYsdx.js → index-B32mP_-H.js} +2219 -2342
- package/dist/index-B32mP_-H.js.map +1 -0
- package/dist/{index-B7xrLR5N.js → index-BVrrnUn0.js} +16 -16
- package/dist/{index-B7xrLR5N.js.map → index-BVrrnUn0.js.map} +1 -1
- package/dist/{index-BYGu3RV5.js → index-BamlKH-k.js} +43 -43
- package/dist/{index-BYGu3RV5.js.map → index-BamlKH-k.js.map} +1 -1
- package/dist/{index-BeAF9HWV.js → index-iImjiPdB.js} +16 -16
- package/dist/{index-BeAF9HWV.js.map → index-iImjiPdB.js.map} +1 -1
- package/dist/{index-nrPtQ1dv.js → index-yEhaxKq-.js} +3 -3
- package/dist/{index-nrPtQ1dv.js.map → index-yEhaxKq-.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{react-18-CbXtwYTX.js → react-18-DXfB7ZX7.js} +2 -2
- package/dist/{react-18-CbXtwYTX.js.map → react-18-DXfB7ZX7.js.map} +1 -1
- package/dist/{react.esm-CJKnSGEF.js → react.esm-WLX_DeH0.js} +19 -19
- package/dist/react.esm-WLX_DeH0.js.map +1 -0
- package/dist/setupTests.js +1 -1
- package/dist/setupTests.js.map +1 -1
- package/dist/storyComponents/ClipboardButton/ClipboardButton.js.map +1 -1
- package/dist/storybook__react.d.js +13 -13
- package/dist/storybook__react.d.js.map +1 -1
- package/dist/{test-utils-ea_YDVtd.js → test-utils-BP59mSnn.js} +3 -3
- package/dist/{test-utils-ea_YDVtd.js.map → test-utils-BP59mSnn.js.map} +1 -1
- package/package.json +1 -1
- package/dist/Lexical.prod-C1B_JvcI.js.map +0 -1
- package/dist/TableCellResizerPlugin-Bao8R6Lv.js +0 -241
- package/dist/TableCellResizerPlugin-Bao8R6Lv.js.map +0 -1
- package/dist/index-BwBhYsdx.js.map +0 -1
- package/dist/react.esm-CJKnSGEF.js.map +0 -1
|
@@ -1,241 +0,0 @@
|
|
|
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
|
-
}, I = 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
|
-
), N = 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
|
-
I(n);
|
|
163
|
-
}
|
|
164
|
-
v(), document.removeEventListener("mouseup", t);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
return t;
|
|
168
|
-
},
|
|
169
|
-
[c, v, I, D]
|
|
170
|
-
), O = 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", N(e));
|
|
178
|
-
},
|
|
179
|
-
[c, N]
|
|
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
|
-
zIndex: 10
|
|
191
|
-
},
|
|
192
|
-
right: {
|
|
193
|
-
backgroundColor: "none",
|
|
194
|
-
cursor: "ew-resize",
|
|
195
|
-
height: `${e}px`,
|
|
196
|
-
left: `${window.pageXOffset + i + t - r / B}px`,
|
|
197
|
-
top: `${window.pageYOffset + o}px`,
|
|
198
|
-
width: `${r}px`,
|
|
199
|
-
zIndex: 10
|
|
200
|
-
}
|
|
201
|
-
}, u = m.current;
|
|
202
|
-
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;
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
bottom: null,
|
|
206
|
-
left: null,
|
|
207
|
-
right: null,
|
|
208
|
-
top: null
|
|
209
|
-
};
|
|
210
|
-
}, [c, a, w])();
|
|
211
|
-
return /* @__PURE__ */ y("div", { ref: p, children: c != null && !z && /* @__PURE__ */ J(Q, { children: [
|
|
212
|
-
/* @__PURE__ */ y(
|
|
213
|
-
"div",
|
|
214
|
-
{
|
|
215
|
-
className: S["table-cell-resizer__resizer"],
|
|
216
|
-
style: P.right || void 0,
|
|
217
|
-
onMouseDown: O("right")
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
/* @__PURE__ */ y(
|
|
221
|
-
"div",
|
|
222
|
-
{
|
|
223
|
-
className: S["table-cell-resizer__resizer"],
|
|
224
|
-
style: P.bottom || void 0,
|
|
225
|
-
onMouseDown: O("bottom")
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
] }) });
|
|
229
|
-
}
|
|
230
|
-
const ve = () => {
|
|
231
|
-
const [l] = A(), d = fe();
|
|
232
|
-
return F(
|
|
233
|
-
() => d ? ie(/* @__PURE__ */ y(we, { editor: l }), document.body) : null,
|
|
234
|
-
[l, d]
|
|
235
|
-
);
|
|
236
|
-
};
|
|
237
|
-
export {
|
|
238
|
-
ve as T,
|
|
239
|
-
fe as a
|
|
240
|
-
};
|
|
241
|
-
//# sourceMappingURL=TableCellResizerPlugin-Bao8R6Lv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellResizerPlugin-Bao8R6Lv.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 zIndex: 10,\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 zIndex: 10,\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,MA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