@uva-glass/component-library 3.41.0 → 3.42.0
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/EmptyStateDataDisplay.css +1 -1
- 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/EmptyStateDataDisplay/EmptyStateDataDisplay.d.ts +4 -1
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.js +28 -19
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.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 +275 -287
- 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.js +4 -4
- 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/dist/types/UserInterface.d.ts +1 -0
- package/package.json +18 -18
- 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
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { o as I } from "../../../../LexicalComposerContext.prod-DLlRM5wP.js";
|
|
3
|
-
import { T as N, C as P, y as v, n as K, a as f, c as S } from "../../../../LexicalList.prod-
|
|
4
|
-
import { _ as B } from "../../../../LexicalSelection.prod-
|
|
3
|
+
import { T as N, C as P, y as v, n as K, a as f, c as S } from "../../../../LexicalList.prod-7DmvPZ_J.js";
|
|
4
|
+
import { _ as B } from "../../../../LexicalSelection.prod-Dmiwka3x.js";
|
|
5
5
|
import { useState as p, useEffect as k } from "react";
|
|
6
6
|
import { c as $ } from "../../../../clsx-OuTLNxxd.js";
|
|
7
|
-
import {
|
|
7
|
+
import { as as w, J as x, a0 as O, P as b, _ as h, $ as U, B as E } from "../../../../Lexical.prod-C1B_JvcI.js";
|
|
8
8
|
import { Icon as J } from "../../../Icon/Icon.js";
|
|
9
|
-
import { s as l } from "../../../../RteEditor.module-
|
|
9
|
+
import { s as l } from "../../../../RteEditor.module-dE9wQTC9.js";
|
|
10
10
|
import { useTranslation as T } from "../../hooks/useTranslation.js";
|
|
11
11
|
const j = {
|
|
12
12
|
bullet: "BulletList",
|
|
13
13
|
number: "NumberedList"
|
|
14
|
-
}, z = ["bullet", "number"],
|
|
14
|
+
}, z = ["bullet", "number"], W = () => {
|
|
15
15
|
const u = T(), [e] = I(), [g, s] = p("paragraph"), [c, _] = p(!1), [m, L] = p(!1), y = () => {
|
|
16
16
|
e.update(() => {
|
|
17
17
|
const t = b();
|
|
@@ -90,6 +90,6 @@ const j = {
|
|
|
90
90
|
)) });
|
|
91
91
|
};
|
|
92
92
|
export {
|
|
93
|
-
|
|
93
|
+
W as ListPlugin
|
|
94
94
|
};
|
|
95
95
|
//# sourceMappingURL=ListPlugin.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as m } from "../../../../LexicalComposerContext.prod-DLlRM5wP.js";
|
|
2
2
|
import { useEffect as c } from "react";
|
|
3
|
-
import { af as f, V as p, P as u } from "../../../../Lexical.prod-
|
|
4
|
-
import { L as i } from "../../../../LexicalUtils.prod-
|
|
5
|
-
import { A as d } from "../../../../LexicalClipboard.prod-
|
|
3
|
+
import { af as f, V as p, P as u } from "../../../../Lexical.prod-C1B_JvcI.js";
|
|
4
|
+
import { L as i } from "../../../../LexicalUtils.prod-w0fZ_Z8S.js";
|
|
5
|
+
import { A as d } from "../../../../LexicalClipboard.prod-Dd64YQH0.js";
|
|
6
6
|
import { d as D } from "../../../../index-nrPtQ1dv.js";
|
|
7
7
|
const w = () => {
|
|
8
8
|
const [e] = m(), l = (t) => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../../../../LexicalComposerContext.prod-DLlRM5wP.js";
|
|
4
|
+
import { T } from "../../../../TableCellResizerPlugin-D6jjhYoD.js";
|
|
5
|
+
import "../../../../LexicalTable.prod-iqHmKv_G.js";
|
|
6
|
+
import "../../../../LexicalUtils.prod-w0fZ_Z8S.js";
|
|
7
|
+
import "../../../../Lexical.prod-C1B_JvcI.js";
|
|
8
|
+
import "react-dom";
|
|
9
|
+
import "../../nodes/TableWrapperNode/TableWrapperNode.js";
|
|
10
|
+
export {
|
|
11
|
+
T as TableCellResizerPlugin
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=TableCellResizerPlugin.js.map
|
package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCellResizerPlugin.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TableCellResizerPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { b as
|
|
3
|
+
import { b as D } from "../../../../TablePlugin-cMMBdz-x.js";
|
|
4
4
|
import "../../../Accordion/Accordion.js";
|
|
5
5
|
import "../../../Buttons/Button.js";
|
|
6
6
|
import "../../../Buttons/LinkButton.js";
|
|
@@ -21,13 +21,14 @@ import "../../helpers.js";
|
|
|
21
21
|
import "../../hooks/useTranslation.js";
|
|
22
22
|
import "../LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
23
23
|
import "../../hooks/components/Flyout.js";
|
|
24
|
-
import "
|
|
24
|
+
import "react-dom";
|
|
25
25
|
import "../../../../index-nrPtQ1dv.js";
|
|
26
|
+
import "../../Providers/LanguageProvider.js";
|
|
26
27
|
import "../../../SelectListbox/SelectListbox.js";
|
|
27
28
|
import "../../../SelectListbox/SelectProvider.js";
|
|
28
29
|
import "../../../Sortable/components/SortableItem.js";
|
|
29
30
|
import "../../../../SortableProvider-l8-7ClBJ.js";
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
D as AddTableForm
|
|
32
33
|
};
|
|
33
34
|
//# sourceMappingURL=AddTableFrom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddTableFrom.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddTableFrom.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../../../LexicalComposerContext.prod-DLlRM5wP.js";
|
|
3
3
|
import "../../../../clsx-OuTLNxxd.js";
|
|
4
|
-
import "../../../../LexicalTable.prod-
|
|
5
|
-
import "../../../../Lexical.prod-
|
|
4
|
+
import "../../../../LexicalTable.prod-iqHmKv_G.js";
|
|
5
|
+
import "../../../../Lexical.prod-C1B_JvcI.js";
|
|
6
|
+
import "../../../../LexicalUtils.prod-w0fZ_Z8S.js";
|
|
6
7
|
import "react";
|
|
7
|
-
import { T as
|
|
8
|
+
import { T as J } from "../../../../TablePlugin-cMMBdz-x.js";
|
|
8
9
|
import "./helpers.js";
|
|
10
|
+
import "../../nodes/TableWrapperNode/TableWrapperNode.js";
|
|
9
11
|
import "../../hooks/useFlyout.js";
|
|
10
12
|
import "../../../Accordion/Accordion.js";
|
|
11
13
|
import "../../../Icon/Icon.js";
|
|
@@ -22,16 +24,17 @@ import "../../../IconButton/IconButton.js";
|
|
|
22
24
|
import "../../../Input/Input.js";
|
|
23
25
|
import "../../../InputField/InputField.js";
|
|
24
26
|
import "react-router";
|
|
25
|
-
import "../../../../RteEditor.module-
|
|
27
|
+
import "../../../../RteEditor.module-dE9wQTC9.js";
|
|
26
28
|
import "../../hooks/useTranslation.js";
|
|
27
29
|
import "../LinkPlugin/LinkContextMenu/LinkContextMenu.js";
|
|
28
|
-
import "
|
|
30
|
+
import "react-dom";
|
|
29
31
|
import "../../../../index-nrPtQ1dv.js";
|
|
32
|
+
import "../../Providers/LanguageProvider.js";
|
|
30
33
|
import "../../../SelectListbox/SelectListbox.js";
|
|
31
34
|
import "../../../SelectListbox/SelectProvider.js";
|
|
32
35
|
import "../../../Sortable/components/SortableItem.js";
|
|
33
36
|
import "../../../../SortableProvider-l8-7ClBJ.js";
|
|
34
37
|
export {
|
|
35
|
-
|
|
38
|
+
J as TablePlugin
|
|
36
39
|
};
|
|
37
40
|
//# sourceMappingURL=TablePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePlugin.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TablePlugin.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableCellNode } from '@lexical/table';
|
|
2
|
+
import { ElementNode, LexicalEditor } from 'lexical';
|
|
3
|
+
export declare const MIN_COLUMN_WIDTH = 32;
|
|
4
|
+
export declare const DEFAULT_COL_WIDTH = 48;
|
|
5
|
+
export declare const BORDER_WIDTHS = 1;
|
|
6
|
+
export declare const PREVENT_OPEN_DELAY = 200;
|
|
7
|
+
export declare const DEFAULT_EDITOR_WIDTH = 320;
|
|
2
8
|
export declare const createTable: (nrOfRows: number, nrOfColumns: number) => ElementNode;
|
|
3
9
|
export declare const deleteRow: (selectedNode: ElementNode) => void;
|
|
4
10
|
export declare const deleteTable: (selectedNode: ElementNode) => void;
|
|
5
11
|
export declare const insertRow: (selectedNode: ElementNode, position: "insertRowAbove" | "insertRowBelow") => void;
|
|
6
12
|
export declare const insertColumn: (selectedNode: ElementNode, position: "insertColumnLeft" | "insertColumnRight") => void;
|
|
7
13
|
export declare const deleteColumn: (selectedNode: ElementNode) => void;
|
|
14
|
+
export declare const getEditorContentWidth: (editor: LexicalEditor) => number;
|
|
15
|
+
export declare const getEditorParrentCellWidth: (node: TableCellNode | null, nrOfColumns: number, editor: LexicalEditor) => number;
|
|
@@ -1,65 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { V as h, R as a, H as w, n as T, B as u, P as b, b as E, z as R, K as g, Y as D, L as I, v as S } from "../../../../LexicalTable.prod-iqHmKv_G.js";
|
|
2
|
+
import { B as N } from "../../../../Lexical.prod-C1B_JvcI.js";
|
|
3
|
+
import { TableWrapperNode as W } from "../../nodes/TableWrapperNode/TableWrapperNode.js";
|
|
4
|
+
const B = 32, c = 48, L = 1, O = 200, P = 320, F = (t, e) => {
|
|
5
|
+
const n = I(0, 0, !1);
|
|
6
|
+
for (let o = 0; o < t; o++) {
|
|
7
|
+
const r = g();
|
|
8
|
+
for (let l = 0; l < e; l++) {
|
|
9
|
+
const s = S(0, void 0, void 0);
|
|
10
|
+
s.append(N()), r.append(s);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
n.append(r);
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
if (o.getChildrenSize() > 1 ?
|
|
17
|
-
const
|
|
18
|
-
|
|
14
|
+
return n;
|
|
15
|
+
}, H = (t) => {
|
|
16
|
+
const e = R(t), n = e.getNextSibling() || e.getPreviousSibling(), o = e.getParentOrThrow();
|
|
17
|
+
if (o.getChildrenSize() > 1 ? e.remove() : o.remove(), n !== null) {
|
|
18
|
+
const r = n.getFirstDescendant();
|
|
19
|
+
r && r.select();
|
|
19
20
|
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const t = p(), o = w(e), s = o.getChildrenSize();
|
|
24
|
-
for (let r = 0; r < s; r++) {
|
|
25
|
-
const c = C(0);
|
|
26
|
-
c.append(u()), t.append(c);
|
|
27
|
-
}
|
|
28
|
-
n === "insertRowAbove" ? o.insertBefore(t) : o.insertAfter(t);
|
|
29
|
-
const l = t.getFirstDescendant();
|
|
30
|
-
l && l.select();
|
|
31
|
-
}, L = (e, n) => {
|
|
32
|
-
const t = w(e);
|
|
33
|
-
if (!h(e))
|
|
21
|
+
}, v = (t) => {
|
|
22
|
+
const e = h(t);
|
|
23
|
+
if (!e)
|
|
34
24
|
throw new Error("Selected node is not a TableCellNode");
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
25
|
+
const n = e.getParent();
|
|
26
|
+
n instanceof W ? n.remove() : e.remove();
|
|
27
|
+
}, z = (t, e) => {
|
|
28
|
+
if (!a(t))
|
|
29
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
30
|
+
const n = g();
|
|
31
|
+
D(e === "insertRowBelow");
|
|
32
|
+
const o = n.getFirstDescendant();
|
|
33
|
+
o && o.select();
|
|
34
|
+
}, K = (t, e) => {
|
|
35
|
+
if (!a(t))
|
|
36
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
37
|
+
const n = w(t);
|
|
38
|
+
let o = u(t);
|
|
39
|
+
const r = n.getChildren(), l = b(t), s = E(e === "insertColumnLeft");
|
|
40
|
+
if (!s) return;
|
|
41
|
+
const d = u(s);
|
|
42
|
+
if (d === -1) return;
|
|
43
|
+
const i = n.getColWidths();
|
|
44
|
+
if (!i) return;
|
|
45
|
+
const m = i.map(
|
|
46
|
+
(C, p) => p === d ? c : C - Math.ceil(c / (i.length - 1))
|
|
47
|
+
);
|
|
48
|
+
n.setColWidths(m), o = e === "insertColumnLeft" ? o : o + 1;
|
|
49
|
+
const f = r[l].getChildren()[o];
|
|
50
|
+
f && f.select();
|
|
51
|
+
}, M = (t) => {
|
|
52
|
+
if (!a(t))
|
|
53
53
|
throw new Error("Selected node is not a TableCellNode");
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
(w(t).getFirstChild()?.getChildrenSize() || 0) === 1 ? v(t) : T();
|
|
55
|
+
}, V = (t) => {
|
|
56
|
+
const e = t.getRootElement();
|
|
57
|
+
if (!e || typeof window > "u") return 0;
|
|
58
|
+
const n = e.getBoundingClientRect(), o = window.getComputedStyle(e), r = parseFloat(o.paddingLeft || "0") + parseFloat(o.paddingRight || "0") + c;
|
|
59
|
+
return Math.max(0, n.width - r);
|
|
60
|
+
}, A = (t, e, n) => {
|
|
61
|
+
if (!t) return 0;
|
|
62
|
+
const o = n.getElementByKey(t.getKey());
|
|
63
|
+
if (!o) return 0;
|
|
64
|
+
const r = window.getComputedStyle(o);
|
|
65
|
+
return parseInt(r.width) - e * L - 1;
|
|
56
66
|
};
|
|
57
67
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
P as
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
L as BORDER_WIDTHS,
|
|
69
|
+
c as DEFAULT_COL_WIDTH,
|
|
70
|
+
P as DEFAULT_EDITOR_WIDTH,
|
|
71
|
+
B as MIN_COLUMN_WIDTH,
|
|
72
|
+
O as PREVENT_OPEN_DELAY,
|
|
73
|
+
F as createTable,
|
|
74
|
+
M as deleteColumn,
|
|
75
|
+
H as deleteRow,
|
|
76
|
+
v as deleteTable,
|
|
77
|
+
V as getEditorContentWidth,
|
|
78
|
+
A as getEditorParrentCellWidth,
|
|
79
|
+
K as insertColumn,
|
|
80
|
+
z as insertRow
|
|
64
81
|
};
|
|
65
82
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../src/components/RteEditor/Plugins/TablePlugin/helpers.ts"],"sourcesContent":["import {\n $createTableNodeWithDimensions,\n $createTableRowNode,\n $createTableCellNode,\n $
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/components/RteEditor/Plugins/TablePlugin/helpers.ts"],"sourcesContent":["import {\n $createTableNodeWithDimensions,\n $createTableRowNode,\n $createTableCellNode,\n $deleteTableColumnAtSelection,\n $isTableCellNode,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowNodeFromTableCellNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $getTableColumnIndexFromTableCellNode,\n $insertTableColumnAtSelection,\n $insertTableRowAtSelection,\n $findTableNode,\n} from '@lexical/table';\nimport { $createParagraphNode } from 'lexical';\n\nimport type { TableCellNode } from '@lexical/table';\nimport type { TextNode, ElementNode, LexicalEditor } from 'lexical';\nimport { TableWrapperNode } from 'components/RteEditor/nodes';\n\nexport const MIN_COLUMN_WIDTH = 32;\nexport const DEFAULT_COL_WIDTH = 48;\nexport const BORDER_WIDTHS = 1;\nexport const PREVENT_OPEN_DELAY = 200;\nexport const DEFAULT_EDITOR_WIDTH = 320;\n\nexport const createTable = (nrOfRows: number, nrOfColumns: number): ElementNode => {\n const tableNode = $createTableNodeWithDimensions(0, 0, false);\n for (let rowIndex = 0; rowIndex < nrOfRows; rowIndex++) {\n const rowNode = $createTableRowNode();\n for (let colIndex = 0; colIndex < nrOfColumns; colIndex++) {\n const cellNode = $createTableCellNode(0, undefined, undefined);\n cellNode.append($createParagraphNode());\n rowNode.append(cellNode);\n }\n tableNode.append(rowNode);\n }\n return tableNode;\n};\n\nexport const deleteRow = (selectedNode: ElementNode) => {\n const currentRow = $getTableRowNodeFromTableCellNodeOrThrow(selectedNode);\n const nextRow = currentRow.getNextSibling() || currentRow.getPreviousSibling();\n const currentTable = currentRow.getParentOrThrow();\n currentTable.getChildrenSize() > 1 ? currentRow.remove() : currentTable.remove();\n\n if (nextRow !== null) {\n const firstDescendant = (nextRow as ElementNode).getFirstDescendant();\n if (firstDescendant) {\n (firstDescendant as TextNode).select();\n }\n }\n};\n\nexport const deleteTable = (selectedNode: ElementNode) => {\n const tableNode = $findTableNode(selectedNode);\n if (!tableNode) {\n throw new Error('Selected node is not a TableCellNode');\n }\n\n const wrapperNode = tableNode.getParent();\n if (wrapperNode instanceof TableWrapperNode) {\n wrapperNode.remove();\n } else {\n tableNode.remove();\n }\n};\n\nexport const insertRow = (selectedNode: ElementNode, position: 'insertRowAbove' | 'insertRowBelow') => {\n if (!$isTableCellNode(selectedNode)) {\n throw new Error('Selected node is not a TableCellNode');\n }\n const newRow = $createTableRowNode();\n\n $insertTableRowAtSelection(position === 'insertRowBelow');\n\n const firstDescendant = newRow.getFirstDescendant();\n if (firstDescendant) {\n (firstDescendant as TextNode).select();\n }\n};\n\nexport const insertColumn = (selectedNode: ElementNode, position: 'insertColumnLeft' | 'insertColumnRight') => {\n if (!$isTableCellNode(selectedNode)) {\n throw new Error('Selected node is not a TableCellNode');\n }\n const currentTable = $getTableNodeFromLexicalNodeOrThrow(selectedNode);\n let columnIndex = $getTableColumnIndexFromTableCellNode(selectedNode);\n const rowsInTable: TableCellNode[] = currentTable.getChildren();\n const rowIndex = $getTableRowIndexFromTableCellNode(selectedNode);\n const insertedCellNode = $insertTableColumnAtSelection(position === 'insertColumnLeft');\n\n if (!insertedCellNode) return;\n const insertedColumnIndex = $getTableColumnIndexFromTableCellNode(insertedCellNode);\n\n if (insertedColumnIndex === -1) return;\n const colWidths = currentTable.getColWidths();\n\n if (!colWidths) return;\n const newColWidths = colWidths.map((width, index) =>\n index === insertedColumnIndex ? DEFAULT_COL_WIDTH : width - Math.ceil(DEFAULT_COL_WIDTH / (colWidths.length - 1))\n );\n\n currentTable.setColWidths(newColWidths);\n\n columnIndex = position === 'insertColumnLeft' ? columnIndex : columnIndex + 1;\n const firstDescendant = rowsInTable[rowIndex].getChildren()[columnIndex];\n if (firstDescendant) {\n (firstDescendant as TextNode).select();\n }\n};\n\nexport const deleteColumn = (selectedNode: ElementNode) => {\n if (!$isTableCellNode(selectedNode)) {\n throw new Error('Selected node is not a TableCellNode');\n }\n const currentTable = $getTableNodeFromLexicalNodeOrThrow(selectedNode);\n const numberOfColumns = (currentTable.getFirstChild() as ElementNode)?.getChildrenSize() || 0;\n\n if (numberOfColumns === 1) {\n deleteTable(selectedNode);\n } else {\n $deleteTableColumnAtSelection();\n }\n};\n\nexport const getEditorContentWidth = (editor: LexicalEditor): number => {\n const rootEl = editor.getRootElement();\n if (!rootEl || typeof window === 'undefined') return 0;\n const rect = rootEl.getBoundingClientRect();\n const styles = window.getComputedStyle(rootEl);\n const insertX = parseFloat(styles.paddingLeft || '0') + parseFloat(styles.paddingRight || '0') + DEFAULT_COL_WIDTH;\n return Math.max(0, rect.width - insertX);\n};\n\nexport const getEditorParrentCellWidth = (\n node: TableCellNode | null,\n nrOfColumns: number,\n editor: LexicalEditor\n): number => {\n if (!node) return 0;\n\n const cell = editor.getElementByKey(node.getKey());\n if (!cell) return 0;\n\n const computedStyles = window.getComputedStyle(cell);\n return parseInt(computedStyles.width) - nrOfColumns * BORDER_WIDTHS - 1;\n};\n"],"names":["MIN_COLUMN_WIDTH","DEFAULT_COL_WIDTH","BORDER_WIDTHS","PREVENT_OPEN_DELAY","DEFAULT_EDITOR_WIDTH","createTable","nrOfRows","nrOfColumns","tableNode","$createTableNodeWithDimensions","rowIndex","rowNode","$createTableRowNode","colIndex","cellNode","$createTableCellNode","$createParagraphNode","deleteRow","selectedNode","currentRow","$getTableRowNodeFromTableCellNodeOrThrow","nextRow","currentTable","firstDescendant","deleteTable","$findTableNode","wrapperNode","TableWrapperNode","insertRow","position","$isTableCellNode","newRow","$insertTableRowAtSelection","insertColumn","$getTableNodeFromLexicalNodeOrThrow","columnIndex","$getTableColumnIndexFromTableCellNode","rowsInTable","$getTableRowIndexFromTableCellNode","insertedCellNode","$insertTableColumnAtSelection","insertedColumnIndex","colWidths","newColWidths","width","index","deleteColumn","$deleteTableColumnAtSelection","getEditorContentWidth","editor","rootEl","rect","styles","insertX","getEditorParrentCellWidth","node","cell","computedStyles"],"mappings":"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"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { jsxs as P, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { o as y } from "../../../../LexicalComposerContext.prod-DLlRM5wP.js";
|
|
3
|
-
import { P as
|
|
3
|
+
import { P as f, _ as h, M as C } from "../../../../Lexical.prod-C1B_JvcI.js";
|
|
4
4
|
import { useState as L, useRef as E, useCallback as T, useEffect as c } from "react";
|
|
5
|
-
import { W as g } from "../../../../LexicalTable.prod-
|
|
5
|
+
import { W as g } from "../../../../LexicalTable.prod-iqHmKv_G.js";
|
|
6
6
|
import { BlockFormatPlugin as N } from "../BlockFormatPlugin/BlockFormatPlugin.js";
|
|
7
7
|
import { ListPlugin as k } from "../ListPlugin/ListPlugin.js";
|
|
8
8
|
import { LinkPlugin as x } from "../LinkPlugin/LinkPlugin.js";
|
|
9
9
|
import { HistoryPlugin as B } from "../HistoryPlugin/HistoryPlugin.js";
|
|
10
|
-
import { T as S } from "../../../../TablePlugin-
|
|
10
|
+
import { T as S } from "../../../../TablePlugin-cMMBdz-x.js";
|
|
11
11
|
import { TableCellContextMenu as _ } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
12
|
-
import
|
|
12
|
+
import "react-dom";
|
|
13
|
+
import "../../../../index-nrPtQ1dv.js";
|
|
14
|
+
import { s as z } from "../../../../RteEditor.module-dE9wQTC9.js";
|
|
13
15
|
import { setScrollableContainers as b, removeScrollableContainers as A } from "../../helpers.js";
|
|
14
|
-
const
|
|
16
|
+
const V = ({ editorScrollPosition: m }) => {
|
|
15
17
|
const [t] = y(), [r, i] = L(null), d = E(null), u = T(() => {
|
|
16
|
-
const e =
|
|
18
|
+
const e = f();
|
|
17
19
|
if (h(e)) {
|
|
18
20
|
const s = e.anchor.getNode(), l = g(s);
|
|
19
21
|
if (l) {
|
|
20
|
-
const
|
|
22
|
+
const p = t.getElementByKey(l.getKey()), a = p ? p.getBoundingClientRect() : { right: 0, bottom: 0, height: 0 };
|
|
21
23
|
i({ xPos: a.right, yPos: a.bottom, height: a.height });
|
|
22
24
|
} else
|
|
23
25
|
i(null);
|
|
@@ -26,7 +28,7 @@ const O = ({ editorScrollPosition: m }) => {
|
|
|
26
28
|
d.current?.mutateTable(e);
|
|
27
29
|
}, o = () => {
|
|
28
30
|
t.update(() => {
|
|
29
|
-
const e =
|
|
31
|
+
const e = f();
|
|
30
32
|
if (h(e)) {
|
|
31
33
|
const s = e.anchor.getNode();
|
|
32
34
|
g(s) && (C(null), i(null));
|
|
@@ -65,6 +67,6 @@ const O = ({ editorScrollPosition: m }) => {
|
|
|
65
67
|
] });
|
|
66
68
|
};
|
|
67
69
|
export {
|
|
68
|
-
|
|
70
|
+
V as ToolBarPlugin
|
|
69
71
|
};
|
|
70
72
|
//# 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, $setSelection } from 'lexical';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { $getTableCellNodeFromLexicalNode } from '@lexical/table';\n\nimport type { JSX } from 'react';\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';\nimport { removeScrollableContainers, setScrollableContainers } from 'components/RteEditor/helpers';\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 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 useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n useEffect(() => {\n setScrollableContainers(handleResizeScroll);\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 removeScrollableContainers(handleResizeScroll);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeydown = () => {\n setScrollableContainers(handleResizeScroll);\n };\n\n window.addEventListener('keydown', removeKeydown, { capture: true });\n\n return () => {\n window.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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 parentScrollPosition={editorScrollPosition} />\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","handleResizeScroll","$setSelection","useEffect","editorState","setScrollableContainers","removeScrollableContainers","removeKeydown","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin","TablePlugin","TableCellContextMenu","LinkPlugin","HistoryPlugin"],"mappings":"
|
|
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 { JSX } from 'react';\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';\nimport { removeScrollableContainers, setScrollableContainers } from 'components/RteEditor/helpers';\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 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 useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n useEffect(() => {\n setScrollableContainers(handleResizeScroll);\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 removeScrollableContainers(handleResizeScroll);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeydown = () => {\n setScrollableContainers(handleResizeScroll);\n };\n\n window.addEventListener('keydown', removeKeydown, { capture: true });\n\n return () => {\n window.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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 parentScrollPosition={editorScrollPosition} />\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","handleResizeScroll","$setSelection","useEffect","editorState","setScrollableContainers","removeScrollableContainers","removeKeydown","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin","TablePlugin","TableCellContextMenu","LinkPlugin","HistoryPlugin"],"mappings":";;;;;;;;;;;;;;;AA8BO,MAAMA,IAAgB,CAAC,EAAE,sBAAAC,QAAsD;AACpF,QAAM,CAACC,CAAM,IAAIC,EAAA,GACX,CAACC,GAAUC,CAAW,IAAIC,EAA0B,IAAI,GACxDC,IAAWC,EAAsB,IAAI,GAErCC,IAAgBC,EAAY,MAAM;AACtC,UAAMC,IAAYC,EAAA;AAClB,QAAIC,EAAkBF,CAAS,GAAG;AAEhC,YAAMG,IADSH,EAAU,OACC,QAAA,GAEpBI,IAAYC,EAAiCF,CAAU;AAC7D,UAAIC,GAAW;AACb,cAAME,IAAUf,EAAO,gBAAgBa,EAAU,QAAQ,GACnDX,IAAWa,IAAUA,EAAQ,sBAAA,IAA0B,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAA;AAC5F,QAAAZ,EAAY,EAAE,MAAMD,EAAS,OAAO,MAAMA,EAAS,QAAQ,QAAQA,EAAS,OAAA,CAAQ;AAAA,MAAA;AAEpF,QAAAC,EAAY,IAAI;AAAA,IAClB;AAAA,EACF,GACC,CAACH,CAAM,CAAC,GAELgB,IAAoB,CAACC,MAAoB;AAC7C,IAAAZ,EAAS,SAAS,YAAYY,CAAM;AAAA,EAAA,GAGhCC,IAAqB,MAAM;AAC/B,IAAAlB,EAAO,OAAO,MAAM;AAClB,YAAMS,IAAYC,EAAA;AAElB,UAAIC,EAAkBF,CAAS,GAAG;AAEhC,cAAMG,IADSH,EAAU,OACC,QAAA;AAG1B,QADkBK,EAAiCF,CAAU,MAE3DO,EAAc,IAAI,GAClBhB,EAAY,IAAI;AAAA,MAClB;AAAA,IACF,CACD;AAAA,EAAA;AAGH,SAAAiB,EAAU,MAAM;AACd,IAAApB,EAAO,uBAAuB,CAAC,EAAE,aAAAqB,QAAkB;AACjD,MAAAA,EAAY,KAAK,MAAM;AACrB,QAAAd,EAAA;AAAA,MAAc,CACf;AAAA,IAAA,CACF;AAAA,EAAA,GACA,CAACP,GAAQO,CAAa,CAAC,GAE1Ba,EAAU,OACRE,EAAwBJ,CAAkB,GAE1C,OAAO,iBAAiB,UAAUA,CAAkB,GACpD,OAAO,iBAAiB,UAAUA,CAAkB,GAE7C,MAAM;AACX,WAAO,oBAAoB,UAAUA,CAAkB,GACvD,OAAO,oBAAoB,UAAUA,CAAkB,GACvDK,EAA2BL,CAAkB;AAAA,EAAA,IAG9C,CAAClB,CAAM,CAAC,GAEXoB,EAAU,MAAM;AACd,UAAMI,IAAgB,MAAM;AAC1B,MAAAF,EAAwBJ,CAAkB;AAAA,IAAA;AAG5C,kBAAO,iBAAiB,WAAWM,GAAe,EAAE,SAAS,IAAM,GAE5D,MAAM;AACX,aAAO,oBAAoB,WAAWA,CAAa;AAAA,IAAA;AAAA,EACrD,GAEC,EAAE,GAGH,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,iBACrB,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAkB;AAAA,sBAClBC,GAAA,EAAW;AAAA,sBACXC,GAAA,EAAY,UAAU,EAAQ5B,GAAW,KAAKG,GAAU;AAAA,IACxDH,KACC,gBAAAyB;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,UAAA7B;AAAA,QACA,sBAAsBH;AAAA,QACtB,UAAUiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAGd,gBAAAW,EAACK,GAAA,EAAW,sBAAsBjC,EAAA,CAAsB;AAAA,sBACvDkC,GAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { ToolBarPlugin as e } from "./ToolbarPlugin/ToolbarPlugin.js";
|
|
2
|
-
import { BlockFormatPlugin as
|
|
2
|
+
import { BlockFormatPlugin as t } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
3
3
|
import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
|
|
4
|
-
import { LinkPlugin as
|
|
5
|
-
import { HistoryPlugin as
|
|
6
|
-
import { T as
|
|
4
|
+
import { LinkPlugin as g, getLinkNodeTag as m } from "./LinkPlugin/LinkPlugin.js";
|
|
5
|
+
import { HistoryPlugin as f } from "./HistoryPlugin/HistoryPlugin.js";
|
|
6
|
+
import { T as u } from "../../../TablePlugin-cMMBdz-x.js";
|
|
7
7
|
import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
8
|
+
import { T as b } from "../../../TableCellResizerPlugin-D6jjhYoD.js";
|
|
9
|
+
import { PasteHandlerPlugin as C } from "./PasteHandlerPlugin/PasteHandlerPlugin.js";
|
|
8
10
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
t as BlockFormatPlugin,
|
|
12
|
+
f as HistoryPlugin,
|
|
13
|
+
g as LinkPlugin,
|
|
12
14
|
n as ListPlugin,
|
|
15
|
+
C as PasteHandlerPlugin,
|
|
13
16
|
T as TableCellContextMenu,
|
|
14
|
-
|
|
17
|
+
b as TableCellResizerPlugin,
|
|
18
|
+
u as TablePlugin,
|
|
15
19
|
e as ToolBarPlugin,
|
|
16
|
-
|
|
20
|
+
m as getLinkNodeTag
|
|
17
21
|
};
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|