@uva-glass/component-library 3.41.1 → 3.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/{Lexical.prod-7x3WP3vd.js → Lexical.prod-C1B_JvcI.js} +100 -99
  2. package/dist/Lexical.prod-C1B_JvcI.js.map +1 -0
  3. package/dist/{LexicalClipboard.prod-BMLLh6JL.js → LexicalClipboard.prod-Dd64YQH0.js} +10 -10
  4. package/dist/{LexicalClipboard.prod-BMLLh6JL.js.map → LexicalClipboard.prod-Dd64YQH0.js.map} +1 -1
  5. package/dist/{LexicalLink.prod-Dr6L083o.js → LexicalLink.prod-ldhpNY9X.js} +3 -3
  6. package/dist/{LexicalLink.prod-Dr6L083o.js.map → LexicalLink.prod-ldhpNY9X.js.map} +1 -1
  7. package/dist/{LexicalList.prod-nl__pKjG.js → LexicalList.prod-7DmvPZ_J.js} +4 -4
  8. package/dist/{LexicalList.prod-nl__pKjG.js.map → LexicalList.prod-7DmvPZ_J.js.map} +1 -1
  9. package/dist/{LexicalSelection.prod-CB_xP0pP.js → LexicalSelection.prod-Dmiwka3x.js} +5 -5
  10. package/dist/{LexicalSelection.prod-CB_xP0pP.js.map → LexicalSelection.prod-Dmiwka3x.js.map} +1 -1
  11. package/dist/{LexicalTable.prod-CwkGGOke.js → LexicalTable.prod-iqHmKv_G.js} +666 -625
  12. package/dist/LexicalTable.prod-iqHmKv_G.js.map +1 -0
  13. package/dist/LexicalUtils.prod-w0fZ_Z8S.js +123 -0
  14. package/dist/{LexicalUtils.prod-CtYaCJNB.js.map → LexicalUtils.prod-w0fZ_Z8S.js.map} +1 -1
  15. package/dist/RteEditor.module-dE9wQTC9.js +42 -0
  16. package/dist/RteEditor.module-dE9wQTC9.js.map +1 -0
  17. package/dist/TableCellResizerPlugin-D6jjhYoD.js +239 -0
  18. package/dist/TableCellResizerPlugin-D6jjhYoD.js.map +1 -0
  19. package/dist/TablePlugin-cMMBdz-x.js +306 -0
  20. package/dist/TablePlugin-cMMBdz-x.js.map +1 -0
  21. package/dist/assets/RteEditor.css +1 -1
  22. package/dist/assets/TableCellResizerPlugin.css +1 -0
  23. package/dist/components/CheckboxTree/CheckboxTree.js +9 -8
  24. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  25. package/dist/components/FormInput/FormInput.js +4 -3
  26. package/dist/components/FormInput/FormInput.js.map +1 -1
  27. package/dist/components/InputField/InputField.stories.js +4 -3
  28. package/dist/components/InputField/InputField.stories.js.map +1 -1
  29. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  30. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  31. package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -2
  32. package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
  33. package/dist/components/MultiSelect/index.js +1 -1
  34. package/dist/components/PeriodSelector/PeriodSelector.js +4 -3
  35. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
  36. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +4 -3
  37. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  38. package/dist/components/RadioTabSelector/RadioTabSelector.js +4 -3
  39. package/dist/components/RadioTabSelector/RadioTabSelector.js.map +1 -1
  40. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +4 -3
  41. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  42. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
  43. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +14 -13
  44. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  45. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +5 -4
  46. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
  47. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  48. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +26 -25
  49. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  50. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  51. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +6 -6
  52. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +3 -3
  53. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.d.ts +2 -0
  54. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +13 -0
  55. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map +1 -0
  56. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.d.ts +1 -0
  57. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +5 -0
  58. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js.map +1 -0
  59. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +4 -3
  60. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
  61. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +9 -6
  62. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  63. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +9 -1
  64. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +73 -56
  65. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
  66. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  67. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +11 -9
  68. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  69. package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
  70. package/dist/components/RteEditor/Plugins/index.js +13 -9
  71. package/dist/components/RteEditor/Plugins/index.js.map +1 -1
  72. package/dist/components/RteEditor/RteEditor.js +307 -319
  73. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  74. package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
  75. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +2 -1
  76. package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
  77. package/dist/components/RteEditor/helpers.d.ts +1 -0
  78. package/dist/components/RteEditor/helpers.js +22 -21
  79. package/dist/components/RteEditor/helpers.js.map +1 -1
  80. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.d.ts +15 -0
  81. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +69 -0
  82. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -0
  83. package/dist/components/RteEditor/nodes/TableWrapperNode/index.d.ts +1 -0
  84. package/dist/components/RteEditor/nodes/TableWrapperNode/index.js +10 -0
  85. package/dist/components/RteEditor/nodes/TableWrapperNode/index.js.map +1 -0
  86. package/dist/components/RteEditor/nodes/index.d.ts +1 -0
  87. package/dist/components/RteEditor/nodes/index.js +10 -0
  88. package/dist/components/RteEditor/nodes/index.js.map +1 -0
  89. package/dist/components/index.js +1 -1
  90. package/dist/{helpers-B0VCD9f3.js → helpers-BO6Gg9y6.js} +4 -4
  91. package/dist/{helpers-B0VCD9f3.js.map → helpers-BO6Gg9y6.js.map} +1 -1
  92. package/dist/index.js +1 -1
  93. package/package.json +2 -2
  94. package/dist/Lexical.prod-7x3WP3vd.js.map +0 -1
  95. package/dist/LexicalTable.prod-CwkGGOke.js.map +0 -1
  96. package/dist/LexicalUtils.prod-CtYaCJNB.js +0 -107
  97. package/dist/RteEditor.module-B_3uFnFu.js +0 -41
  98. package/dist/RteEditor.module-B_3uFnFu.js.map +0 -1
  99. package/dist/TablePlugin-DNGtPPjq.js +0 -301
  100. package/dist/TablePlugin-DNGtPPjq.js.map +0 -1
@@ -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-CwkGGOke.js";
5
- import "../../../../Lexical.prod-7x3WP3vd.js";
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 G } from "../../../../TablePlugin-DNGtPPjq.js";
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-B_3uFnFu.js";
27
+ import "../../../../RteEditor.module-dE9wQTC9.js";
26
28
  import "../../hooks/useTranslation.js";
27
29
  import "../LinkPlugin/LinkContextMenu/LinkContextMenu.js";
28
- import "../../Providers/LanguageProvider.js";
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
- G as TablePlugin
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 { ElementNode } from 'lexical';
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 { H as d, R as h, B as m, Z as x, z as w, P as S, v as C, K as p, L as E } from "../../../../LexicalTable.prod-CwkGGOke.js";
2
- import { B as u } from "../../../../Lexical.prod-7x3WP3vd.js";
3
- const b = 100, D = (e, n) => {
4
- const t = E(0, 0, !1);
5
- for (let o = 0; o < e; o++) {
6
- const s = p();
7
- for (let l = 0; l < n; l++) {
8
- const r = C(0, void 0, b / n);
9
- r.append(u()), s.append(r);
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
- t.append(s);
12
+ n.append(r);
12
13
  }
13
- return t;
14
- }, P = (e) => {
15
- const n = w(e), t = n.getNextSibling() || n.getPreviousSibling(), o = n.getParentOrThrow();
16
- if (o.getChildrenSize() > 1 ? n.remove() : o.remove(), t !== null) {
17
- const s = t.getFirstDescendant();
18
- s && s.select();
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
- }, I = (e) => {
21
- d(e).remove();
22
- }, A = (e, n) => {
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 o = S(e), s = t.getChildren().length, l = d(e);
36
- let r = m(e);
37
- const c = l.getChildren(), R = c.length;
38
- for (let i = 0; i < R; i++) {
39
- const a = C(0);
40
- a.append(u());
41
- const f = c[i].getChildren()[r];
42
- f && (n === "insertColumnLeft" ? f.insertBefore(a) : f.insertAfter(a)), c.forEach((T) => {
43
- T.getChildren().forEach((v) => {
44
- v.setWidth(b / s);
45
- });
46
- });
47
- }
48
- r = n === "insertColumnLeft" ? r : r + 1;
49
- const g = c[o].getChildren()[r];
50
- g && g.select();
51
- }, O = (e) => {
52
- if (!h(e))
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
- const n = d(e), t = n.getFirstChild()?.getChildrenSize() || 0, o = m(e);
55
- t === 1 ? I(e) : x(n, o);
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
- D as createTable,
59
- O as deleteColumn,
60
- P as deleteRow,
61
- I as deleteTable,
62
- L as insertColumn,
63
- A as insertRow
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 $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","$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,EAAA;AAChB,aAASC,IAAW,GAAGA,IAAWN,GAAaM,KAAY;AACzD,YAAMC,IAAWC,EAAqB,GAAG,QAAWX,IAAaG,CAAW;AAC5E,MAAAO,EAAS,OAAOE,GAAsB,GACtCL,EAAQ,OAAOG,CAAQ;AAAA,IAAA;AAEzB,IAAAN,EAAU,OAAOG,CAAO;AAAA,EAAA;AAE1B,SAAOH;AACT,GAEaS,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EAAQ,OAAOf,GAAsB;AACrC,UAAMsB,IAAuBD,EAAYP,CAAQ,EAAE,YAAA,EAAcK,CAAW;AAC5E,IAAIG,MACEX,MAAa,qBACfW,EAAqB,aAAaP,CAAO,IAEzCO,EAAqB,YAAYP,CAAO,IAI5CM,EAAY,QAAQ,CAACE,MAAQ;AAC3B,MAAAA,EAAI,YAAA,EAAc,QAAQ,CAACC,MAAS;AACjC,QAAAA,EAAuB,SAASpC,IAAayB,CAAQ;AAAA,MAAA,CACvD;AAAA,IAAA,CACF;AAAA,EAAA;AAGH,EAAAM,IAAcR,MAAa,qBAAqBQ,IAAcA,IAAc;AAC5E,QAAMZ,IAAkBc,EAAY3B,CAAQ,EAAE,YAAA,EAAcyB,CAAW;AACvE,EAAIZ,KACDA,EAA6B,OAAA;AAElC,GAEakB,IAAe,CAACvB,MAA8B;AACzD,MAAI,CAACe,EAAiBf,CAAY;AAChC,UAAM,IAAI,MAAM,sCAAsC;AAExD,QAAMI,IAAeG,EAAoCP,CAAY,GAC/DwB,IAAmBpB,EAAa,cAAA,GAAiC,qBAAqB,GACtFa,IAAcC,EAAsClB,CAAY;AAEtE,EAAIwB,MAAoB,IACtBlB,EAAYN,CAAY,IAExByB,EAAmBrB,GAAca,CAAW;AAEhD;"}
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":";;;AAoBO,MAAMA,IAAmB,IACnBC,IAAoB,IACpBC,IAAgB,GAChBC,IAAqB,KACrBC,IAAuB,KAEvBC,IAAc,CAACC,GAAkBC,MAAqC;AACjF,QAAMC,IAAYC,EAA+B,GAAG,GAAG,EAAK;AAC5D,WAASC,IAAW,GAAGA,IAAWJ,GAAUI,KAAY;AACtD,UAAMC,IAAUC,EAAA;AAChB,aAASC,IAAW,GAAGA,IAAWN,GAAaM,KAAY;AACzD,YAAMC,IAAWC,EAAqB,GAAG,QAAW,MAAS;AAC7D,MAAAD,EAAS,OAAOE,GAAsB,GACtCL,EAAQ,OAAOG,CAAQ;AAAA,IAAA;AAEzB,IAAAN,EAAU,OAAOG,CAAO;AAAA,EAAA;AAE1B,SAAOH;A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;AAAA,IAAI,CAACE,GAAOC,MACzCA,MAAUJ,IAAsBxC,IAAoB2C,IAAQ,KAAK,KAAK3C,KAAqByC,EAAU,SAAS,EAAE;AAAA,EAAA;AAGlH,EAAApB,EAAa,aAAaqB,CAAY,GAEtCR,IAAcN,MAAa,qBAAqBM,IAAcA,IAAc;AAC5E,QAAMZ,IAAkBc,EAAY3B,CAAQ,EAAE,YAAA,EAAcyB,CAAW;AACvE,EAAIZ,KACDA,EAA6B,OAAA;AAElC,GAEauB,IAAe,CAAC5B,MAA8B;AACzD,MAAI,CAACY,EAAiBZ,CAAY;AAChC,UAAM,IAAI,MAAM,sCAAsC;AAKxD,GAHqBgB,EAAoChB,CAAY,EAC/B,cAAA,GAAiC,qBAAqB,OAEpE,IACtBM,EAAYN,CAAY,IAExB6B,EAAA;AAEJ,GAEaC,IAAwB,CAACC,MAAkC;AACtE,QAAMC,IAASD,EAAO,eAAA;AACtB,MAAI,CAACC,KAAU,OAAO,SAAW,IAAa,QAAO;AACrD,QAAMC,IAAOD,EAAO,sBAAA,GACdE,IAAS,OAAO,iBAAiBF,CAAM,GACvCG,IAAU,WAAWD,EAAO,eAAe,GAAG,IAAI,WAAWA,EAAO,gBAAgB,GAAG,IAAInD;AACjG,SAAO,KAAK,IAAI,GAAGkD,EAAK,QAAQE,CAAO;AACzC,GAEaC,IAA4B,CACvCC,GACAhD,GACA0C,MACW;AACX,MAAI,CAACM,EAAM,QAAO;AAElB,QAAMC,IAAOP,EAAO,gBAAgBM,EAAK,QAAQ;AACjD,MAAI,CAACC,EAAM,QAAO;AAElB,QAAMC,IAAiB,OAAO,iBAAiBD,CAAI;AACnD,SAAO,SAASC,EAAe,KAAK,IAAIlD,IAAcL,IAAgB;AACxE;"}
@@ -1,4 +1,4 @@
1
- import { T as o } from "../../../../TablePlugin-DNGtPPjq.js";
1
+ import { T as o } from "../../../../TablePlugin-cMMBdz-x.js";
2
2
  import { TableCellContextMenu as t } from "./TableCellContextMenu/TableCellContextMenu.js";
3
3
  export {
4
4
  t as TableCellContextMenu,
@@ -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 p, _ as h, M as C } from "../../../../Lexical.prod-7x3WP3vd.js";
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-CwkGGOke.js";
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-DNGtPPjq.js";
10
+ import { T as S } from "../../../../TablePlugin-cMMBdz-x.js";
11
11
  import { TableCellContextMenu as _ } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
12
- import { s as z } from "../../../../RteEditor.module-B_3uFnFu.js";
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 O = ({ editorScrollPosition: m }) => {
16
+ const V = ({ editorScrollPosition: m }) => {
15
17
  const [t] = y(), [r, i] = L(null), d = E(null), u = T(() => {
16
- const e = p();
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 f = t.getElementByKey(l.getKey()), a = f ? f.getBoundingClientRect() : { right: 0, bottom: 0, height: 0 };
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 = p();
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
- O as ToolBarPlugin
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":";;;;;;;;;;;;;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;AAG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;"}
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,C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AAkB,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;"}
@@ -4,3 +4,5 @@ export * from './ListPlugin';
4
4
  export * from './LinkPlugin';
5
5
  export * from './HistoryPlugin';
6
6
  export * from './TablePlugin';
7
+ export * from './TableCellResizerPlugin';
8
+ export * from './PasteHandlerPlugin';
@@ -1,18 +1,22 @@
1
1
  import { ToolBarPlugin as e } from "./ToolbarPlugin/ToolbarPlugin.js";
2
- import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js";
2
+ import { BlockFormatPlugin as t } from "./BlockFormatPlugin/BlockFormatPlugin.js";
3
3
  import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
4
- import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
5
- import { HistoryPlugin as p } from "./HistoryPlugin/HistoryPlugin.js";
6
- import { T as a } from "../../../TablePlugin-DNGtPPjq.js";
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
- l as BlockFormatPlugin,
10
- p as HistoryPlugin,
11
- m as LinkPlugin,
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
- a as TablePlugin,
17
+ b as TableCellResizerPlugin,
18
+ u as TablePlugin,
15
19
  e as ToolBarPlugin,
16
- x as getLinkNodeTag
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":";;;;;;;;;"}