@flozy/editor 9.3.5 → 9.3.6

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 (31) hide show
  1. package/dist/Editor/ChatEditor.js +1 -1
  2. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +422 -0
  3. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +18 -5
  4. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -1
  5. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +3 -2
  6. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +11 -0
  7. package/dist/Editor/Elements/Embed/Image.js +2 -1
  8. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +44 -9
  9. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +16 -2
  10. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +26 -2
  11. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -2
  12. package/dist/Editor/Elements/Table/TableCell.js +4 -0
  13. package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
  14. package/dist/Editor/common/RnD/Utils/gridDropItem.js +58 -7
  15. package/dist/Editor/common/RnD/Utils/index.js +3 -0
  16. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +110 -0
  17. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +112 -0
  18. package/dist/Editor/common/RnD/VirtualElement/helper.js +267 -0
  19. package/dist/Editor/common/RnD/VirtualElement/index.js +185 -102
  20. package/dist/Editor/common/RnD/VirtualElement/styles.js +95 -8
  21. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
  22. package/dist/Editor/common/RnD/index.js +50 -5
  23. package/dist/Editor/common/SnackBar/index.js +43 -0
  24. package/dist/Editor/hooks/useAutoScroll.js +38 -0
  25. package/dist/Editor/hooks/useMouseMove.js +5 -2
  26. package/dist/Editor/hooks/useTable.js +4 -1
  27. package/dist/Editor/utils/divider.js +11 -3
  28. package/dist/Editor/utils/freegrid.js +2 -2
  29. package/dist/Editor/utils/helper.js +62 -9
  30. package/dist/Editor/utils/table.js +45 -37
  31. package/package.json +1 -1
@@ -2,20 +2,28 @@ const useVirtualElementStyles = () => ({
2
2
  root: {
3
3
  width: "320px",
4
4
  position: "fixed",
5
- backgroundColor: "red",
6
- height: "auto",
5
+ // backgroundColor: "red",
6
+ // height: "fit-content",
7
7
  overflow: "visible",
8
- pointerEvents: "none",
9
- opacity: 0,
8
+ // pointerEvents: "none",
9
+ opacity: 1,
10
10
  right: 0,
11
11
  top: 0,
12
12
  "& .freegrid-item": {
13
13
  position: "relative !important",
14
- gridArea: "none !important",
14
+ top: "0 !important",
15
+ gridArea: "var(--gridArea_xs) !important",
15
16
  width: "calc(100% - 48px) !important",
16
- height: "auto !important",
17
+ height: "var(--height_xs) !important",
17
18
  left: "24px !important",
18
- marginTop: "24px !important",
19
+ marginTop: "var(--marginTop_xs) !important",
20
+ outline: "1px solid gray !important",
21
+ // "&.type_box": {
22
+ // // display: "grid !important",
23
+ // // gridTemplateRows: "repeat(auto-fill, 50px) !important",
24
+ // // height: "min-content !important",
25
+ // },
26
+
19
27
  "& .debug-info, & .editor-blocker": {
20
28
  display: "none"
21
29
  },
@@ -25,4 +33,83 @@ const useVirtualElementStyles = () => ({
25
33
  }
26
34
  }
27
35
  });
28
- export default useVirtualElementStyles;
36
+ export default useVirtualElementStyles;
37
+ export const useAutoAlignStyles = () => ({
38
+ root: {
39
+ width: "320px",
40
+ position: "fixed",
41
+ overflow: "visible",
42
+ opacity: 1,
43
+ right: 0,
44
+ top: 0,
45
+ height: "auto !important",
46
+ zIndex: 99999999,
47
+ "& .freegrid-item": {
48
+ position: "relative !important",
49
+ top: "0 !important",
50
+ gridArea: "none !important",
51
+ width: "calc(100% - 48px) !important",
52
+ height: "var(--height_xs) !important",
53
+ left: "24px !important",
54
+ marginTop: "12px !important",
55
+ minHeight: "auto",
56
+ "&.type_box": {
57
+ height: "auto !important"
58
+ },
59
+ // start - default signature classes on free-grid
60
+ "& .fgi_type_signature": {
61
+ height: "100%",
62
+ "& .signature-container": {
63
+ height: "100%",
64
+ LineHeight: 1.43,
65
+ "& .signature-btn-container": {
66
+ height: "100%",
67
+ display: "flex",
68
+ flexDirection: "column",
69
+ "& .sign-placeholder": {
70
+ display: "flex",
71
+ // remove hidden sign placeholder
72
+ width: "100%",
73
+ flexGrow: 1
74
+ },
75
+ "& button": {
76
+ margin: "6px 0px"
77
+ }
78
+ }
79
+ }
80
+ },
81
+ "& .fgi_type_sign": {
82
+ width: "100%",
83
+ height: "100%",
84
+ "& .signature-signed-wrapper": {
85
+ width: "100%",
86
+ height: "100%",
87
+ "& .signature-signed-span": {
88
+ width: "100%",
89
+ height: "100%",
90
+ "& .signed-btn": {
91
+ width: "100%",
92
+ height: "100%",
93
+ display: "flex",
94
+ flexDirection: "column",
95
+ "& img": {
96
+ width: "100% !important",
97
+ maxWidth: "none !important",
98
+ height: "70% !important",
99
+ flexGrow: 1
100
+ }
101
+ }
102
+ }
103
+ }
104
+ },
105
+ // end - default signature classes on free-grid
106
+
107
+ "& .debug-info, & .editor-blocker": {
108
+ display: "none"
109
+ },
110
+ "& .embed": {
111
+ minHeight: "300px"
112
+ }
113
+ }
114
+ }
115
+ });
@@ -1,5 +1,5 @@
1
1
  import { Node, Transforms } from "slate";
2
- const updateAutoProps = (editor, datas = [], breakpoint = "", groupData) => {
2
+ const updateAutoProps = (editor, datas = [], breakpoint = "", updateAll) => {
3
3
  try {
4
4
  // const { heightData } = groupData;
5
5
  for (let i = 0; i < datas.length; i++) {
@@ -14,9 +14,11 @@ const updateAutoProps = (editor, datas = [], breakpoint = "", groupData) => {
14
14
  return a;
15
15
  }, {});
16
16
  const oldProps = Node.get(editor, int_path);
17
- if (!oldProps?.xs_updatedOn) {
17
+ const updateNode = !oldProps?.xs_updatedOn || updateAll;
18
+ if (updateNode) {
18
19
  Transforms.setNodes(editor, {
19
- ...updatedProps
20
+ ...updatedProps,
21
+ xs_updatedOn: new Date().getTime()
20
22
  }, {
21
23
  at: int_path
22
24
  });
@@ -19,6 +19,10 @@ import { removeSign } from "./ElementSettings/OtherSettings";
19
19
  import useDragging from "../../hooks/useDragging";
20
20
  import { dragOverOn } from "../../helper/RnD/focusNode";
21
21
  import { focusSelection, clearSelection, clearSelectionOnly } from "../../helper";
22
+ import { reRenderChildNodes } from "./Utils/gridDropItem";
23
+ import VirtualTextElement from "./VirtualElement/VirtualTextElement";
24
+ import useAutoScroll from "../../hooks/useAutoScroll";
25
+ import ForceAutoAlignment from "./VirtualElement/ForceAutoAlignment";
22
26
  import { jsx as _jsx } from "react/jsx-runtime";
23
27
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
28
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -65,7 +69,9 @@ const RnD = props => {
65
69
  breakpoint = "",
66
70
  handleContextMenuClick = () => {},
67
71
  itemData = {},
68
- customProps
72
+ customProps,
73
+ sectionElement,
74
+ dataSets
69
75
  } = props;
70
76
  const {
71
77
  isSelectedElement,
@@ -73,7 +79,9 @@ const RnD = props => {
73
79
  updateDragging,
74
80
  contextMenu,
75
81
  setContextMenu,
76
- theme
82
+ theme,
83
+ autoAlign,
84
+ setAutoAlign
77
85
  } = useEditorContext();
78
86
  const str_path = path.join("|");
79
87
  const selectedElementProps = isSelectedElement(str_path, type);
@@ -110,6 +118,10 @@ const RnD = props => {
110
118
  const {
111
119
  translation
112
120
  } = customProps;
121
+ const {
122
+ startAutoScroll,
123
+ stopAutoScroll
124
+ } = useAutoScroll(10, "slate-wrapper-scroll-container");
113
125
  useEffect(() => {
114
126
  if (ITEM_TYPES.includes(type)) {
115
127
  if (enable === 1) {
@@ -345,6 +357,16 @@ const RnD = props => {
345
357
  };
346
358
  const onDrag = e => {
347
359
  e.preventDefault();
360
+ const {
361
+ clientY
362
+ } = e;
363
+ if (clientY < 50) {
364
+ startAutoScroll("up");
365
+ } else if (window.innerHeight - clientY < 50) {
366
+ startAutoScroll("down");
367
+ } else {
368
+ stopAutoScroll();
369
+ }
348
370
  const lines = getClosestDraggable(e.clientX, e.clientY, `.freegrid-section_${parentSectionPath} .freegrid-container .freegrid-item.inactive-drag`.replace(/\|/g, "\\|"), ".freegrid-item.active-drag:not(.exclude-virtual)");
349
371
  setAbsPosition({
350
372
  ...absPosition,
@@ -387,6 +409,7 @@ const RnD = props => {
387
409
  const onDragStop = (e, d) => {
388
410
  e.preventDefault();
389
411
  e.stopPropagation();
412
+ stopAutoScroll();
390
413
  if (dragging?.isDragging === 2 && dragging?.position?.strXY && dragging?.dragOver) {
391
414
  d.x = e.x;
392
415
  d.y = e.y;
@@ -447,13 +470,18 @@ const RnD = props => {
447
470
  }
448
471
  const updatedSize = {
449
472
  width: delta?.width + d.width,
450
- height: delta?.height + d.height,
473
+ height: ref.offsetHeight,
451
474
  ...updatedPosition
452
475
  };
453
476
  onChange({
454
477
  ...updatedSize
455
478
  });
456
479
  handleResizeEvent("stop");
480
+ const parentPath = getParentSectionPath({
481
+ ref
482
+ }, ".freegrid-container-parent");
483
+ const formatParentPath = parentPath?.split("|")?.map(m => parseInt(m));
484
+ reRenderChildNodes(editor, formatParentPath);
457
485
  };
458
486
  const onCloseSettings = () => {
459
487
  setSelectedElement({
@@ -555,6 +583,7 @@ const RnD = props => {
555
583
  ...DISABLE_RESIZING
556
584
  },
557
585
  ...getEventProps(),
586
+ ...(dataSets || {}),
558
587
  children: [/*#__PURE__*/_jsx("div", {
559
588
  id: `opt_ref_${str_path}`,
560
589
  style: {
@@ -627,10 +656,26 @@ const RnD = props => {
627
656
  theme: theme,
628
657
  translation: translation
629
658
  }), type === "parent" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualElement, {
630
- parentEle: positionRef?.current?.resizableElement?.current,
631
659
  updated_at: updated_at,
632
660
  path: str_path,
633
- editor: editor
661
+ editor: editor,
662
+ sectionElement: sectionElement,
663
+ sectionCls: `.freegrid-section_${path.join("_")}`,
664
+ dataSets: dataSets
665
+ }) : null, childType === "text" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualTextElement, {
666
+ editor: editor,
667
+ dataSets: dataSets,
668
+ getCurrentEle: getCurrentEle,
669
+ path: path
670
+ }) : null, type === "parent" && breakpoint === "xs" && !readOnly && autoAlign ? /*#__PURE__*/_jsx(ForceAutoAlignment, {
671
+ updated_at: updated_at,
672
+ path: str_path,
673
+ editor: editor,
674
+ sectionElement: sectionElement,
675
+ sectionCls: `.freegrid-section_${path.join("_")}`,
676
+ dataSets: dataSets,
677
+ autoAlign: autoAlign,
678
+ setAutoAlign: setAutoAlign
634
679
  }) : null]
635
680
  });
636
681
  };
@@ -0,0 +1,43 @@
1
+ import Snackbar from "@mui/material/Snackbar";
2
+ import Alert from "@mui/material/Alert";
3
+ import { useState } from "react";
4
+ import { useEditorContext } from "../../hooks/useMouseMove";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const SnackbarAlert = ({
7
+ message,
8
+ setShowSnackBar,
9
+ severity = "info"
10
+ }) => {
11
+ const [open, setOpen] = useState(!!message);
12
+ const {
13
+ theme
14
+ } = useEditorContext();
15
+ return /*#__PURE__*/_jsx(Snackbar, {
16
+ open: open,
17
+ autoHideDuration: 3000,
18
+ onClose: () => {
19
+ setOpen(false);
20
+ setShowSnackBar(false);
21
+ },
22
+ anchorOrigin: {
23
+ vertical: "top",
24
+ horizontal: "right"
25
+ },
26
+ children: /*#__PURE__*/_jsx(Alert, {
27
+ severity: severity,
28
+ onClose: () => {
29
+ setOpen(false);
30
+ setShowSnackBar(false);
31
+ },
32
+ sx: {
33
+ background: theme?.palette?.primary?.gradientBtn,
34
+ color: "#FFFFFF",
35
+ "& .MuiAlert-icon": {
36
+ color: "#FFFFFF"
37
+ }
38
+ },
39
+ children: message
40
+ })
41
+ });
42
+ };
43
+ export default SnackbarAlert;
@@ -0,0 +1,38 @@
1
+ import { useEffect, useRef } from "react";
2
+ function useAutoScroll(speed = 10, scrollElementId = "slate-wrapper-scroll-container") {
3
+ const scrollInterval = useRef(null);
4
+ function getScrollElement() {
5
+ return document.getElementById(scrollElementId) || window;
6
+ }
7
+ function startAutoScroll(direction) {
8
+ if (scrollInterval.current) return; // Prevent multiple intervals
9
+
10
+ const scrollContainer = getScrollElement();
11
+ scrollInterval.current = setInterval(() => {
12
+ scrollContainer.style.scrollBehavior = "auto";
13
+ if (direction === "up") {
14
+ scrollContainer.scrollBy(0, -speed);
15
+ } else if (direction === "down") {
16
+ scrollContainer.scrollBy(0, speed);
17
+ scrollContainer.style.scrollBehavior = "smooth";
18
+ }
19
+ }, 16); // Approx 60fps
20
+ }
21
+
22
+ function stopAutoScroll() {
23
+ if (scrollInterval.current) {
24
+ clearInterval(scrollInterval.current);
25
+ scrollInterval.current = null;
26
+ const scrollContainer = getScrollElement();
27
+ scrollContainer.style.scrollBehavior = "smooth";
28
+ }
29
+ }
30
+ useEffect(() => {
31
+ return () => stopAutoScroll(); // Cleanup on unmount
32
+ }, []);
33
+ return {
34
+ startAutoScroll,
35
+ stopAutoScroll
36
+ };
37
+ }
38
+ export default useAutoScroll;
@@ -40,6 +40,7 @@ export const EditorProvider = ({
40
40
  });
41
41
  const [fontFamilies, setFontFamilies] = useState(defaultFontFamilies);
42
42
  const [activeBreakPoint, setActiveBreakPoint] = useState("");
43
+ const [autoAlign, setAutoAlign] = useState(false);
43
44
  useEffect(() => {
44
45
  window.updateSelectedItem = d => {
45
46
  setSelectedElement(d);
@@ -107,8 +108,10 @@ export const EditorProvider = ({
107
108
  setOpenTheme,
108
109
  activeBreakPoint,
109
110
  setActiveBreakPoint,
110
- triggerRender
111
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, openTheme, activeBreakPoint]);
111
+ triggerRender,
112
+ autoAlign,
113
+ setAutoAlign
114
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, openTheme, activeBreakPoint, autoAlign]);
112
115
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
113
116
  value: otherValues,
114
117
  children: children
@@ -196,7 +196,10 @@ export const TableProvider = ({
196
196
  sensors: sensors,
197
197
  onDragEnd: data => handleDragEnd(data, editor, resetAll),
198
198
  children: [/*#__PURE__*/_jsx(ClickAwayListener, {
199
- onClickAway: () => setTableSelection(getDefaultTableSelection()),
199
+ onClickAway: () => {
200
+ setTableSelection(getDefaultTableSelection());
201
+ setHoverPath(null);
202
+ },
200
203
  children: /*#__PURE__*/_jsx("div", {
201
204
  children: children
202
205
  })
@@ -1,9 +1,12 @@
1
- import { Transforms } from "slate";
1
+ import { Editor, Path, Transforms } from "slate";
2
2
  import insertNewLine from "./insertNewLine";
3
- import { getCurrentNodeText } from "./helper";
3
+ import { getCurrentEntry, getCurrentNodeText } from "./helper";
4
4
  export const insertDivider = editor => {
5
5
  Transforms.delete(editor, editor.selection);
6
6
  const blockText = getCurrentNodeText(editor);
7
+ const {
8
+ currentPath
9
+ } = getCurrentEntry(editor) || {};
7
10
  const divider = {
8
11
  type: "divider",
9
12
  children: [{
@@ -15,6 +18,11 @@ export const insertDivider = editor => {
15
18
  at: editor?.selection
16
19
  });
17
20
  }
18
- Transforms.insertNodes(editor, divider);
21
+ const insertPath = blockText ? Path.next(currentPath) : currentPath;
22
+ Transforms.insertNodes(editor, divider, {
23
+ at: insertPath
24
+ });
19
25
  insertNewLine(editor);
26
+ const newLinePath = Path.next(insertPath);
27
+ Transforms.select(editor, Editor.start(editor, newLinePath));
20
28
  };
@@ -22,8 +22,8 @@ export const insertFreeGridItem = (childType, childTypeNode, extProps = {}, type
22
22
  top_xs: 24,
23
23
  marginTop_xs: 12,
24
24
  width_xs: 250,
25
- height_xs: 300,
26
- gridArea_xs: "1 / 1 / 2 / 2",
25
+ // height_xs: 300,
26
+ // gridArea_xs: "1 / 1 / 2 / 2",
27
27
  sectionBgColor: "rgb(240, 108, 131)",
28
28
  ...(extProps || {})
29
29
  };
@@ -624,20 +624,38 @@ export const getNextNode = editor => {
624
624
  return;
625
625
  }
626
626
  };
627
- export const getPreviousNode = editor => {
627
+ export const getPreviousEntry = editor => {
628
628
  try {
629
- const parentPath = Path.parent(editor?.selection?.anchor?.path);
630
- const previousPath = Path.previous(parentPath);
631
- const previousNode = Node.get(editor, previousPath);
629
+ const prevEntry = Editor.previous(editor, {
630
+ at: editor.selection,
631
+ match: n => Element.isElement(n)
632
+ });
633
+ if (!prevEntry) return null;
634
+ const [previousNode, previousPath] = prevEntry;
632
635
  return {
633
636
  previousNode,
634
637
  previousPath
635
638
  };
636
- } catch (err) {
639
+ } catch (error) {
637
640
  return;
638
641
  }
639
642
  };
640
- const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.children?.some(child => child.type === "dataView");
643
+ export const getCurrentEntry = editor => {
644
+ try {
645
+ const currentEntry = Editor.node(editor, editor.selection, {
646
+ depth: 1
647
+ });
648
+ if (!currentEntry) return null;
649
+ const [currentNode, currentPath] = currentEntry;
650
+ return {
651
+ currentNode,
652
+ currentPath
653
+ };
654
+ } catch (error) {
655
+ return;
656
+ }
657
+ };
658
+ const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.type === "viewData" || node?.children?.some(child => child.type === "dataView");
641
659
  export const isRestrictedNode = (event, editor) => {
642
660
  let isNodeRestricted = false;
643
661
  try {
@@ -651,15 +669,50 @@ export const isRestrictedNode = (event, editor) => {
651
669
  const {
652
670
  previousNode,
653
671
  previousPath
654
- } = getPreviousNode(editor) || {};
655
- if (isRestricted(previousNode)) {
672
+ } = getPreviousEntry(editor) || {};
673
+ const {
674
+ currentNode
675
+ } = getCurrentEntry(editor) || {};
676
+ if (currentNode?.type === "orderedList" || currentNode?.type === "unorderedList") {
677
+ event.preventDefault();
678
+ const path = selection?.anchor?.path;
679
+ if (!path) return;
680
+
681
+ // Lift the selected list-item out of the list
682
+ Transforms.liftNodes(editor, {
683
+ match: n => n.type === "list-item"
684
+ });
685
+
686
+ // Convert the lifted list-item into a paragraph
687
+ Transforms.setNodes(editor, {
688
+ type: "paragraph"
689
+ }, {
690
+ match: n => n.type === "list-item"
691
+ });
692
+
693
+ // Move focus to the modified paragraph (same path)
694
+ Transforms.select(editor, path);
695
+ } else if (isRestricted(previousNode)) {
656
696
  event.preventDefault(); // stops deleting backward
657
697
 
658
698
  // move the cursor to node which is before page-settings node
659
- const pathBeforePageSettings = Path.previous(previousPath);
699
+ const pathBeforePageSettings = Path.previous([previousPath[0]]);
660
700
  const endPath = Editor.end(editor, pathBeforePageSettings);
661
701
  Transforms.select(editor, endPath);
662
702
  isNodeRestricted = true;
703
+ } else if (previousNode?.type === "divider") {
704
+ event.preventDefault();
705
+ Transforms.removeNodes(editor, {
706
+ at: previousPath
707
+ });
708
+ Transforms.insertNodes(editor, {
709
+ type: "paragraph",
710
+ children: [{
711
+ text: " "
712
+ }]
713
+ }, {
714
+ at: previousPath
715
+ });
663
716
  }
664
717
  }
665
718
  return isNodeRestricted;
@@ -450,51 +450,53 @@ export class TableUtil {
450
450
  at: currentTablePath
451
451
  });
452
452
  Transforms.setNodes(this.editor, {
453
- ...rowProps,
454
- tableBorder: tableProps?.borderColor
453
+ ...rowProps
455
454
  }, {
456
455
  at: currentRowPath
457
456
  });
458
457
  Transforms.setNodes(this.editor, {
459
- ...cellProps,
460
- rowBorder: rowProps?.borderColor,
461
- tableBorder: tableProps?.borderColor
458
+ ...cellProps
462
459
  }, {
463
460
  at: currentCellPath
464
461
  });
465
462
  applyColumnStyle(this.editor, currentCellPath, currentTablePath, cellProps, tableProps?.rows);
466
463
 
467
464
  // cell bg entire
468
- if (cellProps?.entireBgColor || tableProps?.borderColor || rowProps?.borderColor) {
469
- const {
470
- rows
471
- } = tableProps;
472
- for (let r = 0; r < rows; r++) {
473
- Transforms.setNodes(this.editor, {
474
- entireBgColor: cellProps?.entireBgColor
475
- }, {
476
- at: [currentCellPath[0], r, currentCellPath[2]]
477
- });
478
- }
479
- }
465
+ // if (
466
+ // cellProps?.entireBgColor ||
467
+ // tableProps?.borderColor ||
468
+ // rowProps?.borderColor
469
+ // ) {
470
+ // const { rows } = tableProps;
471
+
472
+ // for (let r = 0; r < rows; r++) {
473
+ // Transforms.setNodes(
474
+ // this.editor,
475
+ // {
476
+ // entireBgColor: cellProps?.entireBgColor,
477
+ // },
478
+ // { at: [currentCellPath[0], r, currentCellPath[2]] }
479
+ // );
480
+ // }
481
+ // }
480
482
 
481
483
  // cell border all
482
- if (tableProps?.borderColor || rowProps?.borderColor) {
483
- const {
484
- rows,
485
- columns
486
- } = tableProps;
487
- for (let r = 0; r < rows; r++) {
488
- for (let c = 0; c < columns; c++) {
489
- Transforms.setNodes(this.editor, {
490
- entireBorderColor: tableProps?.borderColor,
491
- rowBorder: rowProps?.borderColor
492
- }, {
493
- at: [currentCellPath[0], r, c]
494
- });
495
- }
496
- }
497
- }
484
+ // if (tableProps?.borderColor || rowProps?.borderColor) {
485
+ // const { rows, columns } = tableProps;
486
+
487
+ // for (let r = 0; r < rows; r++) {
488
+ // for (let c = 0; c < columns; c++) {
489
+ // Transforms.setNodes(
490
+ // this.editor,
491
+ // {
492
+ // entireBorderColor: tableProps?.borderColor,
493
+ // rowBorder: rowProps?.borderColor,
494
+ // },
495
+ // { at: [currentCellPath[0], r, c] }
496
+ // );
497
+ // }
498
+ // }
499
+ // }
498
500
  }
499
501
  } catch (err) {
500
502
  console.log(err);
@@ -508,19 +510,25 @@ export class TableUtil {
508
510
  at: path
509
511
  });
510
512
  };
511
- getTableProps = () => {
513
+ getTableProps = otherOptions => {
512
514
  const {
513
515
  selection
514
516
  } = this.editor;
517
+ const options = {
518
+ ...(otherOptions || {})
519
+ };
515
520
  if (!!selection && Range.isCollapsed(selection)) {
516
521
  const [tableNode] = Editor.nodes(this.editor, {
517
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
522
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table",
523
+ ...options
518
524
  });
519
525
  const [tableCellNode] = Editor.nodes(this.editor, {
520
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
526
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell",
527
+ ...options
521
528
  });
522
529
  const [tableRowNode] = Editor.nodes(this.editor, {
523
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
530
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row",
531
+ ...options
524
532
  });
525
533
  if (tableNode && tableCellNode && tableRowNode) {
526
534
  const [currentTable, currentTablePath] = tableNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "9.3.5",
3
+ "version": "9.3.6",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"