@uva-glass/component-library 1.62.8 → 1.62.10
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-B6kL_nwF.js → Lexical.prod-DOTdxgeo.js} +436 -435
- package/dist/Lexical.prod-DOTdxgeo.js.map +1 -0
- package/dist/LexicalLink.prod-Cqa5Im8X.js +208 -0
- package/dist/LexicalLink.prod-Cqa5Im8X.js.map +1 -0
- package/dist/LexicalList.prod-DlqzsJTH.js +564 -0
- package/dist/LexicalList.prod-DlqzsJTH.js.map +1 -0
- package/dist/LexicalTable.prod-BKz2StgB.js +1525 -0
- package/dist/LexicalTable.prod-BKz2StgB.js.map +1 -0
- package/dist/{LexicalUtils.prod-BBoyOK4A.js → LexicalUtils.prod-DlLRWqta.js} +2 -2
- package/dist/{LexicalUtils.prod-BBoyOK4A.js.map → LexicalUtils.prod-DlLRWqta.js.map} +1 -1
- package/dist/RteEditor.module-DcvGRx3a.js +21 -0
- package/dist/RteEditor.module-DcvGRx3a.js.map +1 -0
- package/dist/TablePlugin-BkczRiUz.js +303 -0
- package/dist/TablePlugin-BkczRiUz.js.map +1 -0
- package/dist/assets/Flyout.css +1 -1
- package/dist/assets/LinkContextMenu.css +1 -0
- package/dist/assets/RteEditor.css +1 -1
- 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 +4 -3
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/FormInput/FormInput.js +8 -7
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/Icon/icons/index.d.ts +6 -0
- package/dist/components/Icon/icons/index.js +46 -41
- package/dist/components/Icon/icons/index.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/RteEditor/EditorHeader/EditorHeader.js +8 -7
- 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 +9 -8
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/{AddLinkFrom.d.ts → AddLinkForm/AddLinkFrom.d.ts} +0 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +32 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/{AddLinkFrom.js.map → AddLinkForm/AddLinkFrom.js.map} +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.d.ts +11 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +55 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +5 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +153 -126
- 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 +69 -10
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +3 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +7 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +63 -7
- 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 +5 -5
- package/dist/components/RteEditor/RteEditor.d.ts +3 -3
- package/dist/components/RteEditor/RteEditor.js +459 -450
- 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/RteEditor/UvaTheme/UvaTheme.d.ts +3 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +12 -10
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
- package/dist/components/RteEditor/helpers.d.ts +5 -0
- package/dist/components/RteEditor/helpers.js +30 -0
- package/dist/components/RteEditor/helpers.js.map +1 -0
- package/dist/components/RteEditor/hooks/components/Flyout.d.ts +4 -0
- package/dist/components/RteEditor/hooks/components/Flyout.js +18 -10
- package/dist/components/RteEditor/hooks/components/Flyout.js.map +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.d.ts +4 -0
- package/dist/components/RteEditor/hooks/useFlyout.js +10 -9
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/helpers-CC9_diXm.js +168 -0
- package/dist/helpers-CC9_diXm.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +15 -15
- package/dist/Lexical.prod-B6kL_nwF.js.map +0 -1
- package/dist/ListPlugin-CpLcVKRP.js +0 -627
- package/dist/ListPlugin-CpLcVKRP.js.map +0 -1
- package/dist/RteEditor.module-CHbWzGpE.js +0 -28
- package/dist/RteEditor.module-CHbWzGpE.js.map +0 -1
- package/dist/TablePlugin-B-yAWpsC.js +0 -310
- package/dist/TablePlugin-B-yAWpsC.js.map +0 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +0 -31
- package/dist/helpers-C7Yo7VY3.js +0 -367
- package/dist/helpers-C7Yo7VY3.js.map +0 -1
- package/dist/helpers-pUTvcL4e.js +0 -1578
- package/dist/helpers-pUTvcL4e.js.map +0 -1
|
@@ -1,10 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as S, a as h, n as d, f as C, p as w, o as m, m as D, C as p, T as E } from "../../../../LexicalTable.prod-BKz2StgB.js";
|
|
2
|
+
import { D as u } from "../../../../Lexical.prod-DOTdxgeo.js";
|
|
3
|
+
const b = 100, O = (e, n) => {
|
|
4
|
+
const t = S(0, 0, !1);
|
|
5
|
+
for (let o = 0; o < e; o++) {
|
|
6
|
+
const r = h();
|
|
7
|
+
for (let l = 0; l < n; l++) {
|
|
8
|
+
const s = d(0, void 0, b / n);
|
|
9
|
+
s.append(u()), r.append(s);
|
|
10
|
+
}
|
|
11
|
+
t.append(r);
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
}, z = (e) => {
|
|
15
|
+
const n = C(e), t = n.getNextSibling() || n.getPreviousSibling(), o = n.getParentOrThrow();
|
|
16
|
+
if (o.getChildrenSize() > 1 ? n.remove() : o.remove(), t !== null) {
|
|
17
|
+
const r = t.getFirstDescendant();
|
|
18
|
+
r && r.select();
|
|
19
|
+
}
|
|
20
|
+
}, I = (e) => {
|
|
21
|
+
w(e).remove();
|
|
22
|
+
}, F = (e, n) => {
|
|
23
|
+
const t = h(), o = C(e), r = o.getChildrenSize();
|
|
24
|
+
for (let s = 0; s < r; s++) {
|
|
25
|
+
const c = d(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
|
+
}, P = (e, n) => {
|
|
32
|
+
const t = C(e);
|
|
33
|
+
if (!m(e))
|
|
34
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
35
|
+
const o = D(e), r = t.getChildren().length, l = w(e);
|
|
36
|
+
let s = p(e);
|
|
37
|
+
const c = l.getChildren(), T = c.length;
|
|
38
|
+
for (let i = 0; i < T; i++) {
|
|
39
|
+
const a = d(0);
|
|
40
|
+
a.append(u());
|
|
41
|
+
const f = c[i].getChildren()[s];
|
|
42
|
+
f && (n === "insertColumnLeft" ? f.insertBefore(a) : f.insertAfter(a)), c.forEach((R) => {
|
|
43
|
+
R.getChildren().forEach((x) => {
|
|
44
|
+
x.setWidth(b / r);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
s = n === "insertColumnLeft" ? s : s + 1;
|
|
49
|
+
const g = c[o].getChildren()[s];
|
|
50
|
+
g && g.select();
|
|
51
|
+
}, B = (e) => {
|
|
52
|
+
var r;
|
|
53
|
+
if (!m(e))
|
|
54
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
55
|
+
const n = w(e), t = ((r = n.getFirstChild()) == null ? void 0 : r.getChildrenSize()) || 0, o = p(e);
|
|
56
|
+
t === 1 ? I(e) : E(n, o);
|
|
57
|
+
};
|
|
2
58
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
59
|
+
O as createTable,
|
|
60
|
+
B as deleteColumn,
|
|
61
|
+
z as deleteRow,
|
|
62
|
+
I as deleteTable,
|
|
63
|
+
P as insertColumn,
|
|
64
|
+
F as insertRow
|
|
9
65
|
};
|
|
10
66
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/components/RteEditor/Plugins/TablePlugin/helpers.ts"],"sourcesContent":["import {\n $createTableNodeWithDimensions,\n $createTableRowNode,\n $createTableCellNode,\n $deleteTableColumn,\n $isTableCellNode,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowNodeFromTableCellNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $getTableColumnIndexFromTableCellNode,\n} from '@lexical/table';\nimport { type TextNode, type ElementNode, $createParagraphNode } from 'lexical';\n\nimport type { TableCellNode } from '@lexical/table';\n\nconst PERCENTAGE = 100;\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, PERCENTAGE / nrOfColumns);\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 $getTableNodeFromLexicalNodeOrThrow(selectedNode).remove();\n};\n\nexport const insertRow = (selectedNode: ElementNode, position: 'insertRowAbove' | 'insertRowBelow') => {\n const newRow = $createTableRowNode();\n const currentRow = $getTableRowNodeFromTableCellNodeOrThrow(selectedNode);\n const nrOfCols = currentRow.getChildrenSize();\n for (let rowCount = 0; rowCount < nrOfCols; rowCount++) {\n const newCell = $createTableCellNode(0);\n newCell.append($createParagraphNode());\n newRow.append(newCell);\n }\n position === 'insertRowAbove' ? currentRow.insertBefore(newRow) : currentRow.insertAfter(newRow);\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 const currentRow = $getTableRowNodeFromTableCellNodeOrThrow(selectedNode);\n if (!$isTableCellNode(selectedNode)) {\n throw new Error('Selected node is not a TableCellNode');\n }\n const rowIndex = $getTableRowIndexFromTableCellNode(selectedNode);\n const nrOfCols = currentRow.getChildren().length;\n const currentTable = $getTableNodeFromLexicalNodeOrThrow(selectedNode);\n let columnIndex = $getTableColumnIndexFromTableCellNode(selectedNode);\n const rowsInTable: TableCellNode[] = currentTable.getChildren();\n const nrOfRows = rowsInTable.length;\n\n for (let rowCount = 0; rowCount < nrOfRows; rowCount++) {\n const newCell = $createTableCellNode(0);\n newCell.append($createParagraphNode());\n const cellInSelectedColumn = rowsInTable[rowCount].getChildren()[columnIndex];\n if (cellInSelectedColumn) {\n if (position === 'insertColumnLeft') {\n cellInSelectedColumn.insertBefore(newCell);\n } else {\n cellInSelectedColumn.insertAfter(newCell);\n }\n }\n\n rowsInTable.forEach((row) => {\n row.getChildren().forEach((cell) => {\n (cell as TableCellNode).setWidth(PERCENTAGE / nrOfCols);\n });\n });\n }\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 const columnIndex = $getTableColumnIndexFromTableCellNode(selectedNode);\n\n if (numberOfColumns === 1) {\n deleteTable(selectedNode);\n } else {\n $deleteTableColumn(currentTable, columnIndex);\n }\n};\n"],"names":["PERCENTAGE","createTable","nrOfRows","nrOfColumns","tableNode","$createTableNodeWithDimensions","rowIndex","rowNode","$createTableRowNode","colIndex","cellNode","$createTableCellNode","$createParagraphNode","deleteRow","selectedNode","currentRow","$getTableRowNodeFromTableCellNodeOrThrow","nextRow","currentTable","firstDescendant","deleteTable","$getTableNodeFromLexicalNodeOrThrow","insertRow","position","newRow","nrOfCols","rowCount","newCell","insertColumn","$isTableCellNode","$getTableRowIndexFromTableCellNode","columnIndex","$getTableColumnIndexFromTableCellNode","rowsInTable","cellInSelectedColumn","row","cell","deleteColumn","numberOfColumns","_a","$deleteTableColumn"],"mappings":";;AAeA,MAAMA,IAAa,KAENC,IAAc,CAACC,GAAkBC,MAAqC;AACjF,QAAMC,IAAYC,EAA+B,GAAG,GAAG,EAAK;AAC5D,WAASC,IAAW,GAAGA,IAAWJ,GAAUI,KAAY;AACtD,UAAMC,IAAUC;AAChB,aAASC,IAAW,GAAGA,IAAWN,GAAaM,KAAY;AACzD,YAAMC,IAAWC,EAAqB,GAAG,QAAWX,IAAaG,CAAW;AACnE,MAAAO,EAAA,OAAOE,GAAsB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KAAY;AAChD,UAAAC,IAAUhB,EAAqB,CAAC;AAC9B,IAAAgB,EAAA,OAAOf,GAAsB;AACrC,UAAMsB,IAAuBD,EAAYP,CAAQ,EAAE,YAAA,EAAcK,CAAW;AAC5E,IAAIG,MACEX,MAAa,qBACfW,EAAqB,aAAaP,CAAO,IAEzCO,EAAqB,YAAYP,CAAO,IAIhCM,EAAA,QAAQ,CAACE,MAAQ;AAC3B,MAAAA,EAAI,YAAY,EAAE,QAAQ,CAACC,MAAS;AACjC,QAAAA,EAAuB,SAASpC,IAAayB,CAAQ;AAAA,MAAA,CACvD;AAAA,IAAA,CACF;AAAA,EACH;AAEc,EAAAM,IAAAR,MAAa,qBAAqBQ,IAAcA,IAAc;AAC5E,QAAMZ,IAAkBc,EAAY3B,CAAQ,EAAE,YAAA,EAAcyB,CAAW;AACvE,EAAIZ,KACDA,EAA6B,OAAO;AAEzC,GAEakB,IAAe,CAACvB,MAA8B;;AACrD,MAAA,CAACe,EAAiBf,CAAY;AAC1B,UAAA,IAAI,MAAM,sCAAsC;AAElD,QAAAI,IAAeG,EAAoCP,CAAY,GAC/DwB,MAAmBC,IAAArB,EAAa,cAAc,MAA3B,gBAAAqB,EAA8C,sBAAqB,GACtFR,IAAcC,EAAsClB,CAAY;AAEtE,EAAIwB,MAAoB,IACtBlB,EAAYN,CAAY,IAExB0B,EAAmBtB,GAAca,CAAW;AAEhD;"}
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { u as
|
|
3
|
-
import { M as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { g as
|
|
6
|
-
import { BlockFormatPlugin as
|
|
7
|
-
import {
|
|
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 f, v as g, E as w } from "../../../../Lexical.prod-DOTdxgeo.js";
|
|
4
|
+
import { useState as E, useRef as C, useCallback as L, useEffect as p } from "react";
|
|
5
|
+
import { g as h } from "../../../../LexicalTable.prod-BKz2StgB.js";
|
|
6
|
+
import { BlockFormatPlugin as T } from "../BlockFormatPlugin/BlockFormatPlugin.js";
|
|
7
|
+
import { ListPlugin as y } from "../ListPlugin/ListPlugin.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-BkczRiUz.js";
|
|
11
|
+
import { TableCellContextMenu as k } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
12
|
+
import { s as z } from "../../../../RteEditor.module-DcvGRx3a.js";
|
|
13
|
+
const G = ({ editorScrollPosition: c }) => {
|
|
14
|
+
const [e] = P(), [i, s] = E(null), m = C(null), d = L(() => {
|
|
15
|
+
const o = f();
|
|
16
|
+
if (g(o)) {
|
|
17
|
+
const u = o.anchor.getNode(), r = h(u);
|
|
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 = m.current) == null || t.mutateTable(o);
|
|
27
27
|
};
|
|
28
|
-
return
|
|
28
|
+
return p(() => {
|
|
29
29
|
e.registerUpdateListener(({ editorState: o }) => {
|
|
30
30
|
o.read(() => {
|
|
31
|
-
|
|
31
|
+
d();
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
}, [e,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
}, [e, d]), p(() => {
|
|
35
|
+
const o = () => {
|
|
36
|
+
e.update(() => {
|
|
37
|
+
const t = f();
|
|
38
|
+
if (g(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: m }),
|
|
51
|
+
i && /* @__PURE__ */ n(
|
|
52
|
+
k,
|
|
40
53
|
{
|
|
41
|
-
position:
|
|
42
|
-
parentScrollPosition:
|
|
43
|
-
onAction:
|
|
54
|
+
position: i,
|
|
55
|
+
parentScrollPosition: c,
|
|
56
|
+
onAction: b
|
|
44
57
|
}
|
|
45
58
|
),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ n(N, { parentScrollPosition: c }),
|
|
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 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","_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,GAA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AAY,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,IAEF,gBAAAS,EAACK,GAAW,EAAA,sBAAsB/B,EAAsB,CAAA;AAAA,sBACvDgC,GAAc,EAAA;AAAA,EACjB,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ToolBarPlugin as e } from "./ToolbarPlugin/ToolbarPlugin.js";
|
|
2
2
|
import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
|
|
4
4
|
import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
|
|
5
|
-
import { HistoryPlugin as
|
|
6
|
-
import { T as
|
|
5
|
+
import { HistoryPlugin as p } from "./HistoryPlugin/HistoryPlugin.js";
|
|
6
|
+
import { T as a } from "../../../TablePlugin-BkczRiUz.js";
|
|
7
7
|
import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
8
8
|
export {
|
|
9
9
|
l as BlockFormatPlugin,
|
|
10
|
-
|
|
10
|
+
p as HistoryPlugin,
|
|
11
11
|
m as LinkPlugin,
|
|
12
12
|
n as ListPlugin,
|
|
13
13
|
T as TableCellContextMenu,
|
|
14
|
-
|
|
14
|
+
a as TablePlugin,
|
|
15
15
|
e as ToolBarPlugin,
|
|
16
16
|
x as getLinkNodeTag
|
|
17
17
|
};
|
|
@@ -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;
|
|
@@ -9,13 +9,13 @@ export interface RteEditorProps {
|
|
|
9
9
|
label?: string;
|
|
10
10
|
/** explanation of the text to be filled in, in current Language */
|
|
11
11
|
info?: string;
|
|
12
|
-
/** 'true' the rte field
|
|
12
|
+
/** 'true' the rte field mandatory */
|
|
13
13
|
required?: boolean;
|
|
14
14
|
/** max number of words 'allowed' but not enforced */
|
|
15
15
|
maxWords?: number;
|
|
16
16
|
/** max height in rem default = 20rem*/
|
|
17
17
|
maxHeightInRem?: `${number}rem`;
|
|
18
|
-
/** error text to display if required and field is
|
|
18
|
+
/** error text to display if required and field is empty */
|
|
19
19
|
notValidatedText?: string;
|
|
20
20
|
/** updated output */
|
|
21
21
|
onChange: (content: string) => void;
|