@uva-glass/component-library 1.62.7 → 1.62.9
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-eo-UKDld.js → Lexical.prod-B6kL_nwF.js} +159 -159
- package/dist/Lexical.prod-B6kL_nwF.js.map +1 -0
- package/dist/{LexicalUtils.prod-DzksRdFe.js → LexicalUtils.prod-BBoyOK4A.js} +22 -22
- package/dist/{LexicalUtils.prod-DzksRdFe.js.map → LexicalUtils.prod-BBoyOK4A.js.map} +1 -1
- package/dist/{ListPlugin-DsPphjdE.js → ListPlugin-CpLcVKRP.js} +17 -17
- package/dist/{ListPlugin-DsPphjdE.js.map → ListPlugin-CpLcVKRP.js.map} +1 -1
- package/dist/TablePlugin-DQR5VWGq.js +301 -0
- package/dist/TablePlugin-DQR5VWGq.js.map +1 -0
- package/dist/assets/favicon/android-chrome-192x192.png +0 -0
- package/dist/assets/favicon/android-chrome-512x512.png +0 -0
- package/dist/assets/favicon/apple-touch-icon.png +0 -0
- package/dist/assets/favicon/favicon-16x16.png +0 -0
- package/dist/assets/favicon/favicon-32x32.png +0 -0
- package/dist/assets/favicon/favicon.ico +0 -0
- package/dist/assets/favicon/favicon.svg +27 -0
- package/dist/assets/favicon/site.webmanifest +19 -0
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/InputField/InputField.stories.js +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 +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +7 -7
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +32 -32
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +7 -6
- 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 +50 -37
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/RteEditor.d.ts +1 -1
- package/dist/components/RteEditor/RteEditor.js +140 -138
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.stories.js +1 -1
- package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BD3Y_bqE.js → helpers-C7Yo7VY3.js} +34 -34
- package/dist/{helpers-BD3Y_bqE.js.map → helpers-C7Yo7VY3.js.map} +1 -1
- package/dist/{helpers-DONVwywj.js → helpers-CVB_4CnL.js} +127 -125
- package/dist/helpers-CVB_4CnL.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/dist/Lexical.prod-eo-UKDld.js.map +0 -1
- package/dist/TablePlugin-hmwPCCLn.js +0 -310
- package/dist/TablePlugin-hmwPCCLn.js.map +0 -1
- package/dist/helpers-DONVwywj.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as b, jsxs as A } from "react/jsx-runtime";
|
|
2
2
|
import { u as V } from "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
3
|
import { c as j } from "../../../../clsx-OuTLNxxd.js";
|
|
4
|
-
import { g as D, m as
|
|
5
|
-
import { useRef as m, useState as
|
|
6
|
-
import { e as
|
|
7
|
-
import { A as Z } from "../../../../TablePlugin-
|
|
4
|
+
import { g as D, m as M, e as z, U as W } from "../../../../helpers-C7Yo7VY3.js";
|
|
5
|
+
import { useRef as m, useState as Y, useEffect as g } from "react";
|
|
6
|
+
import { e as q, M as f, r as B, v as x, _ as G, O as J, c as Q, E as X } from "../../../../Lexical.prod-B6kL_nwF.js";
|
|
7
|
+
import { A as Z } from "../../../../TablePlugin-DQR5VWGq.js";
|
|
8
8
|
import { useFlyout as $ } from "../../hooks/useFlyout.js";
|
|
9
9
|
import { Icon as tt } from "../../../Icon/Icon.js";
|
|
10
10
|
import "../../../Buttons/Button.js";
|
|
@@ -47,17 +47,17 @@ const rt = 200, F = (u) => {
|
|
|
47
47
|
}
|
|
48
48
|
return !1;
|
|
49
49
|
}, Rt = () => {
|
|
50
|
-
const u = et(), [t] = V(), { flyout: R, showFlyout: h, hideFlyout: S, isVisible: p } = $(), a = m(), N = m(!1), d = m(""), l = m(""), [_,
|
|
50
|
+
const u = et(), [t] = V(), { flyout: R, showFlyout: h, hideFlyout: S, isVisible: p } = $(), a = m(), N = m(!1), d = m(""), l = m(""), [_, O] = Y({ active: !1, url: "", linktext: "" }), w = m(p), v = m(null), y = () => {
|
|
51
51
|
t.update(() => {
|
|
52
52
|
const o = f();
|
|
53
|
-
|
|
53
|
+
v.current = o;
|
|
54
54
|
});
|
|
55
55
|
}, U = () => {
|
|
56
56
|
t.update(() => {
|
|
57
|
-
|
|
57
|
+
v.current && X(v.current);
|
|
58
58
|
});
|
|
59
59
|
}, H = () => {
|
|
60
|
-
N.current || (y(), h(
|
|
60
|
+
N.current || (y(), h(T), l.current !== "" && setTimeout(() => {
|
|
61
61
|
var o;
|
|
62
62
|
return (o = a.current) == null ? void 0 : o.setDefaults("", l.current);
|
|
63
63
|
}, 0));
|
|
@@ -66,7 +66,7 @@ const rt = 200, F = (u) => {
|
|
|
66
66
|
}, I = (o, r) => {
|
|
67
67
|
t.update(() => {
|
|
68
68
|
const e = f();
|
|
69
|
-
if (
|
|
69
|
+
if (x(e)) {
|
|
70
70
|
const n = e.anchor.getNode(), i = F(n);
|
|
71
71
|
if (r && r !== "") {
|
|
72
72
|
if (i) {
|
|
@@ -74,23 +74,23 @@ const rt = 200, F = (u) => {
|
|
|
74
74
|
i.replace(c), c.select();
|
|
75
75
|
}
|
|
76
76
|
if (r !== d.current && d.current === "") {
|
|
77
|
-
const { anchor: c, focus:
|
|
78
|
-
e.insertText(r), c.offset -= r.length,
|
|
77
|
+
const { anchor: c, focus: C } = e;
|
|
78
|
+
e.insertText(r), c.offset -= r.length, C.offset = c.offset + r.length;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
z(
|
|
81
|
+
M(z(o), { target: "_blank" });
|
|
82
82
|
}
|
|
83
83
|
L();
|
|
84
84
|
});
|
|
85
|
-
},
|
|
86
|
-
children: /* @__PURE__ */
|
|
85
|
+
}, T = {
|
|
86
|
+
children: /* @__PURE__ */ b(
|
|
87
87
|
Z,
|
|
88
88
|
{
|
|
89
89
|
isLink: _,
|
|
90
90
|
onCloseHandler: L,
|
|
91
91
|
onSaveHandler: (o, r) => I(o, r),
|
|
92
92
|
onRemoveHandler: () => {
|
|
93
|
-
t.dispatchCommand(
|
|
93
|
+
t.dispatchCommand(W, null), L();
|
|
94
94
|
},
|
|
95
95
|
ref: a
|
|
96
96
|
}
|
|
@@ -101,21 +101,21 @@ const rt = 200, F = (u) => {
|
|
|
101
101
|
p ? (N.current = !0, (r = a.current) == null || r.focusFirstField()) : ((o = a.current) == null || o.clearForm(), d.current = l.current = "", setTimeout(() => N.current = !1, rt));
|
|
102
102
|
}, [a, p]), g(() => {
|
|
103
103
|
const o = t.registerCommand(
|
|
104
|
-
|
|
104
|
+
q,
|
|
105
105
|
() => {
|
|
106
106
|
const e = f();
|
|
107
107
|
return l.current = (e == null ? void 0 : e.getTextContent()) ?? "", !1;
|
|
108
108
|
},
|
|
109
109
|
0
|
|
110
110
|
), r = t.registerCommand(
|
|
111
|
-
|
|
111
|
+
B,
|
|
112
112
|
(e) => {
|
|
113
113
|
const s = f();
|
|
114
|
-
if (
|
|
114
|
+
if (x(s)) {
|
|
115
115
|
y();
|
|
116
116
|
const n = E(s.anchor.getNode());
|
|
117
117
|
if (n)
|
|
118
|
-
return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), h(
|
|
118
|
+
return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), h(T), d.current = n.linktext, setTimeout(() => {
|
|
119
119
|
var i;
|
|
120
120
|
return (i = a.current) == null ? void 0 : i.setDefaults(n.url, n.linktext);
|
|
121
121
|
}, 0), !0;
|
|
@@ -131,31 +131,31 @@ const rt = 200, F = (u) => {
|
|
|
131
131
|
};
|
|
132
132
|
}, [t]), g(() => {
|
|
133
133
|
const o = t.registerCommand(
|
|
134
|
-
|
|
134
|
+
G,
|
|
135
135
|
(e) => {
|
|
136
136
|
if (e.ctrlKey && e.shiftKey && e.key === "U") {
|
|
137
137
|
const s = f();
|
|
138
|
-
if (y(), !
|
|
138
|
+
if (y(), !x(s))
|
|
139
139
|
return !1;
|
|
140
|
-
const n = E(s.anchor.getNode()), i = (
|
|
141
|
-
h(
|
|
140
|
+
const n = E(s.anchor.getNode()), i = (C = "", K = "") => {
|
|
141
|
+
h(T), setTimeout(() => {
|
|
142
142
|
var P;
|
|
143
|
-
return (P = a.current) == null ? void 0 : P.setDefaults(
|
|
143
|
+
return (P = a.current) == null ? void 0 : P.setDefaults(C, K);
|
|
144
144
|
}, 0);
|
|
145
145
|
};
|
|
146
146
|
if (n)
|
|
147
147
|
return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), d.current = n.linktext, i(n.url, n.linktext), !0;
|
|
148
148
|
const c = s.getTextContent();
|
|
149
|
-
return c !== "" ? (l.current = c, i("", l.current), !0) : (h(
|
|
149
|
+
return c !== "" ? (l.current = c, i("", l.current), !0) : (h(T), !0);
|
|
150
150
|
}
|
|
151
151
|
return !1;
|
|
152
152
|
},
|
|
153
|
-
|
|
153
|
+
J
|
|
154
154
|
), r = t.registerUpdateListener(({ editorState: e }) => {
|
|
155
|
-
|
|
155
|
+
O(
|
|
156
156
|
e.read(() => {
|
|
157
157
|
const s = f();
|
|
158
|
-
if (y(),
|
|
158
|
+
if (y(), x(s)) {
|
|
159
159
|
const n = s.anchor.getNode(), i = F(n);
|
|
160
160
|
if (i)
|
|
161
161
|
return {
|
|
@@ -182,8 +182,8 @@ const rt = 200, F = (u) => {
|
|
|
182
182
|
return window.addEventListener("keydown", o, { capture: !0 }), () => {
|
|
183
183
|
window.removeEventListener("keydown", o);
|
|
184
184
|
};
|
|
185
|
-
}, []), /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
185
|
+
}, []), /* @__PURE__ */ b("div", { className: k["editor__toolbar-button-group"], children: /* @__PURE__ */ A("div", { className: k["editor__toolbar-button-flyoutwrapper"], children: [
|
|
186
|
+
/* @__PURE__ */ b(
|
|
187
187
|
"button",
|
|
188
188
|
{
|
|
189
189
|
onClick: H,
|
|
@@ -196,7 +196,7 @@ const rt = 200, F = (u) => {
|
|
|
196
196
|
"aria-label": u.aria.labels.link,
|
|
197
197
|
"aria-keyshortcuts": u.aria.keyshortcuts.link,
|
|
198
198
|
type: "button",
|
|
199
|
-
children: /* @__PURE__ */
|
|
199
|
+
children: /* @__PURE__ */ b(tt, { name: "Link", size: 20 })
|
|
200
200
|
}
|
|
201
201
|
),
|
|
202
202
|
R
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
|
-
import { L as f } from "../../../../ListPlugin-
|
|
3
|
+
import { L as f } from "../../../../ListPlugin-CpLcVKRP.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../../../clsx-OuTLNxxd.js";
|
|
6
|
-
import "../../../../Lexical.prod-
|
|
6
|
+
import "../../../../Lexical.prod-B6kL_nwF.js";
|
|
7
7
|
import "../../../Icon/Icon.js";
|
|
8
8
|
import "../../../../RteEditor.module-CHbWzGpE.js";
|
|
9
9
|
import "../../hooks/useTranslation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { b as v } from "../../../../TablePlugin-
|
|
3
|
+
import { b as v } from "../../../../TablePlugin-DQR5VWGq.js";
|
|
4
4
|
import "../../../Buttons/Button.js";
|
|
5
5
|
import "../../../Buttons/LinkButton.js";
|
|
6
6
|
import "@react-aria/button";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
3
|
import "../../../../clsx-OuTLNxxd.js";
|
|
4
|
-
import "../../../../helpers-
|
|
5
|
-
import "../../../../Lexical.prod-
|
|
4
|
+
import "../../../../helpers-CVB_4CnL.js";
|
|
5
|
+
import "../../../../Lexical.prod-B6kL_nwF.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { T as B } from "../../../../TablePlugin-
|
|
7
|
+
import { T as B } from "../../../../TablePlugin-DQR5VWGq.js";
|
|
8
8
|
import "../../hooks/useFlyout.js";
|
|
9
9
|
import "../../../Icon/Icon.js";
|
|
10
10
|
import "../../../Buttons/Button.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { e as
|
|
1
|
+
import { e as t, a as l, b as o, d as r, i as d, c as i } from "../../../../helpers-CVB_4CnL.js";
|
|
2
|
+
import "../../../../Lexical.prod-B6kL_nwF.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
t as createTable,
|
|
4
5
|
l as deleteColumn,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
o as deleteRow,
|
|
7
|
+
r as deleteTable,
|
|
8
|
+
d as insertColumn,
|
|
9
|
+
i as insertRow
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { u as
|
|
3
|
-
import {
|
|
4
|
-
import { useState as
|
|
5
|
-
import { g as
|
|
6
|
-
import { BlockFormatPlugin as
|
|
7
|
-
import { L as
|
|
8
|
-
import { LinkPlugin as
|
|
9
|
-
import { HistoryPlugin as
|
|
10
|
-
import { T as
|
|
11
|
-
import { TableCellContextMenu as
|
|
12
|
-
import { s as
|
|
13
|
-
const
|
|
14
|
-
const [e] =
|
|
15
|
-
const o =
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
s({ xPos:
|
|
1
|
+
import { jsxs as v, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { u as P } from "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
|
+
import { M as u, v as f, E as w } from "../../../../Lexical.prod-B6kL_nwF.js";
|
|
4
|
+
import { useState as E, useRef as L, useCallback as C, useEffect as g } from "react";
|
|
5
|
+
import { g as h } from "../../../../helpers-CVB_4CnL.js";
|
|
6
|
+
import { BlockFormatPlugin as T } from "../BlockFormatPlugin/BlockFormatPlugin.js";
|
|
7
|
+
import { L as y } from "../../../../ListPlugin-CpLcVKRP.js";
|
|
8
|
+
import { LinkPlugin as N } from "../LinkPlugin/LinkPlugin.js";
|
|
9
|
+
import { HistoryPlugin as x } from "../HistoryPlugin/HistoryPlugin.js";
|
|
10
|
+
import { T as B } from "../../../../TablePlugin-DQR5VWGq.js";
|
|
11
|
+
import { TableCellContextMenu as k } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
12
|
+
import { s as z } from "../../../../RteEditor.module-CHbWzGpE.js";
|
|
13
|
+
const G = ({ editorScrollPosition: p }) => {
|
|
14
|
+
const [e] = P(), [i, s] = E(null), c = L(null), m = C(() => {
|
|
15
|
+
const o = u();
|
|
16
|
+
if (f(o)) {
|
|
17
|
+
const d = o.anchor.getNode(), r = h(d);
|
|
18
|
+
if (r) {
|
|
19
|
+
const l = e.getElementByKey(r.getKey()), a = l ? l.getBoundingClientRect() : { right: 0, bottom: 0, height: 0 };
|
|
20
|
+
s({ xPos: a.right, yPos: a.bottom, height: a.height });
|
|
21
21
|
} else
|
|
22
22
|
s(null);
|
|
23
23
|
}
|
|
24
|
-
}, [e]),
|
|
25
|
-
var
|
|
26
|
-
(
|
|
24
|
+
}, [e]), b = (o) => {
|
|
25
|
+
var t;
|
|
26
|
+
(t = c.current) == null || t.mutateTable(o);
|
|
27
27
|
};
|
|
28
|
-
return
|
|
28
|
+
return g(() => {
|
|
29
29
|
e.registerUpdateListener(({ editorState: o }) => {
|
|
30
30
|
o.read(() => {
|
|
31
|
-
|
|
31
|
+
m();
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
}, [e,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
}, [e, m]), g(() => {
|
|
35
|
+
const o = () => {
|
|
36
|
+
e.update(() => {
|
|
37
|
+
const t = u();
|
|
38
|
+
if (f(t)) {
|
|
39
|
+
const r = t.anchor.getNode();
|
|
40
|
+
h(r) && (w(null), s(null));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return window.addEventListener("scroll", o), window.addEventListener("resize", o), () => {
|
|
45
|
+
window.removeEventListener("scroll", o), window.removeEventListener("resize", o);
|
|
46
|
+
};
|
|
47
|
+
}, [e]), /* @__PURE__ */ v("div", { className: z.editor__toolbar, children: [
|
|
48
|
+
/* @__PURE__ */ n(T, {}),
|
|
49
|
+
/* @__PURE__ */ n(y, {}),
|
|
50
|
+
/* @__PURE__ */ n(B, { isActive: !!i, ref: c }),
|
|
51
|
+
i && /* @__PURE__ */ n(
|
|
52
|
+
k,
|
|
40
53
|
{
|
|
41
|
-
position:
|
|
42
|
-
parentScrollPosition:
|
|
43
|
-
onAction:
|
|
54
|
+
position: i,
|
|
55
|
+
parentScrollPosition: p,
|
|
56
|
+
onAction: b
|
|
44
57
|
}
|
|
45
58
|
),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ n(N, {}),
|
|
60
|
+
/* @__PURE__ */ n(x, {})
|
|
48
61
|
] });
|
|
49
62
|
};
|
|
50
63
|
export {
|
|
51
|
-
|
|
64
|
+
G as ToolBarPlugin
|
|
52
65
|
};
|
|
53
66
|
//# sourceMappingURL=ToolbarPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { $getSelection, $isRangeSelection } from 'lexical';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { $getTableCellNodeFromLexicalNode } from '@lexical/table';\n\nimport type { Actions } from 'components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu';\nimport type { TableMutation } from 'components/RteEditor/Plugins/TablePlugin/TablePlugin';\n\nimport {\n LinkPlugin,\n BlockFormatPlugin,\n ListPlugin,\n HistoryPlugin,\n TablePlugin,\n TableCellContextMenu,\n} from 'components/RteEditor/Plugins';\nimport styles from 'components/RteEditor/RteEditor.module.css';\n\nexport type Position = {\n xPos: number;\n yPos: number;\n height: number;\n};\n\ninterface ToolBarProps {\n editorScrollPosition: number;\n}\n\nexport const ToolBarPlugin = ({ editorScrollPosition }: ToolBarProps): JSX.Element => {\n const [editor] = useLexicalComposerContext();\n const [position, setPosition] = useState<Position | null>(null);\n const tableref = useRef<TableMutation>(null);\n\n const updateToolbar = useCallback(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor;\n const anchorNode = anchor.getNode();\n\n const tableCell = $getTableCellNodeFromLexicalNode(anchorNode);\n if (tableCell) {\n const domNode = editor.getElementByKey(tableCell.getKey());\n const position = domNode ? domNode.getBoundingClientRect() : { right: 0, bottom: 0, height: 0 };\n setPosition({ xPos: position.right, yPos: position.bottom, height: position.height });\n } else {\n setPosition(null);\n }\n }\n }, [editor]);\n\n const handleTableAction = (action: Actions) => {\n tableref.current?.mutateTable(action);\n };\n\n useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n return (\n <div className={styles['editor__toolbar']}>\n <BlockFormatPlugin />\n <ListPlugin />\n <TablePlugin isActive={Boolean(position)} ref={tableref} />\n {position && (\n <TableCellContextMenu\n position={position}\n parentScrollPosition={editorScrollPosition}\n onAction={handleTableAction}\n />\n )}\n <LinkPlugin />\n <HistoryPlugin />\n </div>\n );\n};\n"],"names":["ToolBarPlugin","editorScrollPosition","editor","useLexicalComposerContext","position","setPosition","useState","tableref","useRef","updateToolbar","useCallback","selection","$getSelection","$isRangeSelection","anchorNode","tableCell","$getTableCellNodeFromLexicalNode","domNode","handleTableAction","action","_a","useEffect","editorState","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin","TablePlugin","TableCellContextMenu","LinkPlugin","HistoryPlugin"],"mappings":";;;;;;;;;;;;AA4BO,MAAMA,IAAgB,CAAC,EAAE,sBAAAC,QAAsD;AAC9E,QAAA,CAACC,CAAM,IAAIC,KACX,CAACC,GAAUC,CAAW,IAAIC,EAA0B,IAAI,GACxDC,IAAWC,EAAsB,IAAI,GAErCC,IAAgBC,EAAY,MAAM;AACtC,UAAMC,IAAYC;AACd,QAAAC,EAAkBF,CAAS,GAAG;AAE1B,YAAAG,IADSH,EAAU,OACC,WAEpBI,IAAYC,EAAiCF,CAAU;AAC7D,UAAIC,GAAW;AACb,cAAME,IAAUf,EAAO,gBAAgBa,EAAU,OAAQ,CAAA,GACnDX,IAAWa,IAAUA,EAAQ,sBAAsB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAE;AAClF,QAAAZ,EAAA,EAAE,MAAMD,EAAS,OAAO,MAAMA,EAAS,QAAQ,QAAQA,EAAS,OAAQ,CAAA;AAAA,MAAA;AAEpF,QAAAC,EAAY,IAAI;AAAA,IAEpB;AAAA,EAAA,GACC,CAACH,CAAM,CAAC,GAELgB,IAAoB,CAACC,MAAoB;;AACpC,KAAAC,IAAAb,EAAA,YAAA,QAAAa,EAAS,YAAYD;AAAA,EAAM;AAGtC,SAAAE,EAAU,MAAM;AACd,IAAAnB,EAAO,uBAAuB,CAAC,EAAE,aAAAoB,QAAkB;AACjD,MAAAA,EAAY,KAAK,MAAM;AACP,QAAAb;MAAA,CACf;AAAA,IAAA,CACF;AAAA,EAAA,GACA,CAACP,GAAQO,CAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"ToolbarPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { $getSelection, $isRangeSelection, $setSelection } from 'lexical';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { $getTableCellNodeFromLexicalNode } from '@lexical/table';\n\nimport type { Actions } from 'components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu';\nimport type { TableMutation } from 'components/RteEditor/Plugins/TablePlugin/TablePlugin';\n\nimport {\n LinkPlugin,\n BlockFormatPlugin,\n ListPlugin,\n HistoryPlugin,\n TablePlugin,\n TableCellContextMenu,\n} from 'components/RteEditor/Plugins';\nimport styles from 'components/RteEditor/RteEditor.module.css';\n\nexport type Position = {\n xPos: number;\n yPos: number;\n height: number;\n};\n\ninterface ToolBarProps {\n editorScrollPosition: number;\n}\n\nexport const ToolBarPlugin = ({ editorScrollPosition }: ToolBarProps): JSX.Element => {\n const [editor] = useLexicalComposerContext();\n const [position, setPosition] = useState<Position | null>(null);\n const tableref = useRef<TableMutation>(null);\n\n const updateToolbar = useCallback(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor;\n const anchorNode = anchor.getNode();\n\n const tableCell = $getTableCellNodeFromLexicalNode(anchorNode);\n if (tableCell) {\n const domNode = editor.getElementByKey(tableCell.getKey());\n const position = domNode ? domNode.getBoundingClientRect() : { right: 0, bottom: 0, height: 0 };\n setPosition({ xPos: position.right, yPos: position.bottom, height: position.height });\n } else {\n setPosition(null);\n }\n }\n }, [editor]);\n\n const handleTableAction = (action: Actions) => {\n tableref.current?.mutateTable(action);\n };\n\n useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n useEffect(() => {\n const handleResizeScroll = () => {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor;\n const anchorNode = anchor.getNode();\n\n const tableCell = $getTableCellNodeFromLexicalNode(anchorNode);\n if (tableCell) {\n $setSelection(null);\n setPosition(null);\n }\n }\n });\n };\n\n window.addEventListener('scroll', handleResizeScroll);\n window.addEventListener('resize', handleResizeScroll);\n\n return () => {\n window.removeEventListener('scroll', handleResizeScroll);\n window.removeEventListener('resize', handleResizeScroll);\n };\n }, [editor]);\n\n return (\n <div className={styles['editor__toolbar']}>\n <BlockFormatPlugin />\n <ListPlugin />\n <TablePlugin isActive={Boolean(position)} ref={tableref} />\n {position && (\n <TableCellContextMenu\n position={position}\n parentScrollPosition={editorScrollPosition}\n onAction={handleTableAction}\n />\n )}\n <LinkPlugin />\n <HistoryPlugin />\n </div>\n );\n};\n"],"names":["ToolBarPlugin","editorScrollPosition","editor","useLexicalComposerContext","position","setPosition","useState","tableref","useRef","updateToolbar","useCallback","selection","$getSelection","$isRangeSelection","anchorNode","tableCell","$getTableCellNodeFromLexicalNode","domNode","handleTableAction","action","_a","useEffect","editorState","handleResizeScroll","$setSelection","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin","TablePlugin","TableCellContextMenu","LinkPlugin","HistoryPlugin"],"mappings":";;;;;;;;;;;;AA4BO,MAAMA,IAAgB,CAAC,EAAE,sBAAAC,QAAsD;AAC9E,QAAA,CAACC,CAAM,IAAIC,KACX,CAACC,GAAUC,CAAW,IAAIC,EAA0B,IAAI,GACxDC,IAAWC,EAAsB,IAAI,GAErCC,IAAgBC,EAAY,MAAM;AACtC,UAAMC,IAAYC;AACd,QAAAC,EAAkBF,CAAS,GAAG;AAE1B,YAAAG,IADSH,EAAU,OACC,WAEpBI,IAAYC,EAAiCF,CAAU;AAC7D,UAAIC,GAAW;AACb,cAAME,IAAUf,EAAO,gBAAgBa,EAAU,OAAQ,CAAA,GACnDX,IAAWa,IAAUA,EAAQ,sBAAsB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAE;AAClF,QAAAZ,EAAA,EAAE,MAAMD,EAAS,OAAO,MAAMA,EAAS,QAAQ,QAAQA,EAAS,OAAQ,CAAA;AAAA,MAAA;AAEpF,QAAAC,EAAY,IAAI;AAAA,IAEpB;AAAA,EAAA,GACC,CAACH,CAAM,CAAC,GAELgB,IAAoB,CAACC,MAAoB;;AACpC,KAAAC,IAAAb,EAAA,YAAA,QAAAa,EAAS,YAAYD;AAAA,EAAM;AAGtC,SAAAE,EAAU,MAAM;AACd,IAAAnB,EAAO,uBAAuB,CAAC,EAAE,aAAAoB,QAAkB;AACjD,MAAAA,EAAY,KAAK,MAAM;AACP,QAAAb;MAAA,CACf;AAAA,IAAA,CACF;AAAA,EAAA,GACA,CAACP,GAAQO,CAAa,CAAC,GAE1BY,EAAU,MAAM;AACd,UAAME,IAAqB,MAAM;AAC/B,MAAArB,EAAO,OAAO,MAAM;AAClB,cAAMS,IAAYC;AAEd,YAAAC,EAAkBF,CAAS,GAAG;AAE1B,gBAAAG,IADSH,EAAU,OACC;AAG1B,UADkBK,EAAiCF,CAAU,MAE3DU,EAAc,IAAI,GAClBnB,EAAY,IAAI;AAAA,QAEpB;AAAA,MAAA,CACD;AAAA,IAAA;AAGI,kBAAA,iBAAiB,UAAUkB,CAAkB,GAC7C,OAAA,iBAAiB,UAAUA,CAAkB,GAE7C,MAAM;AACJ,aAAA,oBAAoB,UAAUA,CAAkB,GAChD,OAAA,oBAAoB,UAAUA,CAAkB;AAAA,IAAA;AAAA,EACzD,GACC,CAACrB,CAAM,CAAC,GAGR,gBAAAuB,EAAA,OAAA,EAAI,WAAWC,EAAO,iBACrB,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAkB,EAAA;AAAA,sBAClBC,GAAW,EAAA;AAAA,sBACXC,GAAY,EAAA,UAAU,EAAQ1B,GAAW,KAAKG,GAAU;AAAA,IACxDH,KACC,gBAAAuB;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,UAAA3B;AAAA,QACA,sBAAsBH;AAAA,QACtB,UAAUiB;AAAA,MAAA;AAAA,IACZ;AAAA,sBAEDc,GAAW,EAAA;AAAA,sBACXC,GAAc,EAAA;AAAA,EACjB,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToolBarPlugin as e } from "./ToolbarPlugin/ToolbarPlugin.js";
|
|
2
2
|
import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
3
|
-
import { L as n } from "../../../ListPlugin-
|
|
3
|
+
import { L as n } from "../../../ListPlugin-CpLcVKRP.js";
|
|
4
4
|
import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
|
|
5
5
|
import { HistoryPlugin as f } from "./HistoryPlugin/HistoryPlugin.js";
|
|
6
|
-
import { T as u } from "../../../TablePlugin-
|
|
6
|
+
import { T as u } from "../../../TablePlugin-DQR5VWGq.js";
|
|
7
7
|
import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
8
8
|
export {
|
|
9
9
|
l as BlockFormatPlugin,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface RteEditorProps {
|
|
2
|
-
/** current language setting for the editor labels NOT title ans label*/
|
|
2
|
+
/** current language setting for the editor labels NOT title ans label */
|
|
3
3
|
currentLanguage?: 'NL' | 'EN';
|
|
4
4
|
/** imported content to edit */
|
|
5
5
|
initialValue?: string;
|