@flozy/editor 4.9.2 → 4.9.4

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 (37) hide show
  1. package/dist/Editor/Editor.css +16 -9
  2. package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -3
  4. package/dist/Editor/Elements/AI/Styles.js +7 -1
  5. package/dist/Editor/Elements/Carousel/Carousel.js +3 -0
  6. package/dist/Editor/Elements/Divider/Divider.js +4 -2
  7. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  8. package/dist/Editor/Elements/Search/SearchAttachment.js +32 -26
  9. package/dist/Editor/Elements/Search/SearchButton.js +66 -9
  10. package/dist/Editor/Elements/Search/SearchList.js +87 -75
  11. package/dist/Editor/Elements/Table/AddRowCol.js +76 -0
  12. package/dist/Editor/Elements/Table/DragButton.js +134 -0
  13. package/dist/Editor/Elements/Table/DragStyles.js +43 -0
  14. package/dist/Editor/Elements/Table/Draggable.js +25 -0
  15. package/dist/Editor/Elements/Table/Droppable.js +53 -0
  16. package/dist/Editor/Elements/Table/Styles.js +23 -41
  17. package/dist/Editor/Elements/Table/Table.js +185 -137
  18. package/dist/Editor/Elements/Table/TableCell.js +339 -101
  19. package/dist/Editor/Elements/Table/TablePopup.js +9 -3
  20. package/dist/Editor/Elements/Table/TableRow.js +10 -2
  21. package/dist/Editor/Elements/Table/TableTool.js +101 -0
  22. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +1 -2
  23. package/dist/Editor/Toolbar/PopupTool/index.js +19 -19
  24. package/dist/Editor/assets/svg/DocsIcon.js +77 -10
  25. package/dist/Editor/assets/svg/TableIcons.js +220 -0
  26. package/dist/Editor/assets/svg/UserIcon.js +2 -2
  27. package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
  28. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +9 -35
  29. package/dist/Editor/common/StyleBuilder/formStyle.js +101 -69
  30. package/dist/Editor/common/StyleBuilder/index.js +8 -34
  31. package/dist/Editor/common/StyleBuilder/tableStyle.js +92 -1
  32. package/dist/Editor/common/iconListV2.js +52 -0
  33. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  34. package/dist/Editor/hooks/useTable.js +164 -0
  35. package/dist/Editor/utils/helper.js +1 -1
  36. package/dist/Editor/utils/table.js +204 -21
  37. package/package.json +1 -1
@@ -42,7 +42,7 @@ blockquote {
42
42
  }
43
43
 
44
44
  .editor-wrapper table {
45
- border-collapse: separate;
45
+ border-collapse: collapse;
46
46
  }
47
47
 
48
48
  .editor-wrapper .editor-wrapperbutton {
@@ -1214,14 +1214,6 @@ blockquote {
1214
1214
  position: absolute;
1215
1215
  }
1216
1216
 
1217
- .dividerComponent:hover {
1218
- padding: 10px 0;
1219
- }
1220
-
1221
- .dividerComponent.readonlyDivider:hover {
1222
- padding: 0;
1223
- }
1224
-
1225
1217
  .dividerComponent:hover .divider-settings {
1226
1218
  display: block;
1227
1219
  }
@@ -1235,4 +1227,19 @@ blockquote {
1235
1227
  .settingsHeader {
1236
1228
  font-size: 14px !important;
1237
1229
  font-weight: 500 !important;
1230
+ }
1231
+ .hideScroll {
1232
+ overflow-anchor: none;
1233
+ }
1234
+
1235
+ .hideScroll::-webkit-scrollbar-track {
1236
+ background: none !important;
1237
+ }
1238
+
1239
+ .hideScroll::-webkit-scrollbar-thumb {
1240
+ background: none !important;
1241
+ }
1242
+
1243
+ .hideScroll::-webkit-scrollbar-thumb:hover {
1244
+ background: none !important;
1238
1245
  }
@@ -8,12 +8,14 @@ function CustomSelect({
8
8
  classes,
9
9
  options,
10
10
  onSend,
11
- show
11
+ show,
12
+ btnProps = {}
12
13
  }) {
13
14
  if (show) {
14
15
  return /*#__PURE__*/_jsx(Box, {
15
16
  component: "div",
16
17
  sx: classes.customSelectContainer,
18
+ className: "customSelectContainer",
17
19
  children: options?.map((groupOption, index) => {
18
20
  const {
19
21
  options,
@@ -28,7 +30,8 @@ function CustomSelect({
28
30
  return /*#__PURE__*/_jsx(DisplayOption, {
29
31
  option: option,
30
32
  classes: classes,
31
- onSend: onSend
33
+ onSend: onSend,
34
+ btnProps: btnProps
32
35
  }, i);
33
36
  })]
34
37
  }, index);
@@ -42,15 +45,18 @@ export default CustomSelect;
42
45
  function DisplayOption({
43
46
  option,
44
47
  classes,
45
- onSend
48
+ onSend,
49
+ btnProps = {}
46
50
  }) {
47
51
  const {
48
- Icon
52
+ Icon,
53
+ Component
49
54
  } = option;
50
55
  const [open, setOpen] = useState(false);
51
56
  const optionRef = useRef();
57
+ const showChild = option.options?.length || Component;
52
58
  const openOptions = e => {
53
- if (option.options?.length && !open) {
59
+ if (showChild && !open) {
54
60
  setOpen(e.currentTarget);
55
61
  return;
56
62
  }
@@ -66,7 +72,7 @@ function DisplayOption({
66
72
  e.stopPropagation();
67
73
 
68
74
  // is having child options
69
- if (option.options?.length) {
75
+ if (showChild) {
70
76
  openOptions(e);
71
77
  return;
72
78
  }
@@ -75,18 +81,19 @@ function DisplayOption({
75
81
  },
76
82
  id: "infinity-select-popover",
77
83
  className: open ? "active" : "",
84
+ ...btnProps,
78
85
  children: [/*#__PURE__*/_jsxs("div", {
79
86
  className: "option-label",
80
87
  id: "infinity-select-popover",
81
88
  children: [Icon && /*#__PURE__*/_jsx(Icon, {}), option.label]
82
- }), option.options?.length && /*#__PURE__*/_jsx(IconButton, {
89
+ }), showChild ? /*#__PURE__*/_jsx(IconButton, {
83
90
  children: /*#__PURE__*/_jsx(FaChevronRight, {
84
91
  color: "#94A3B8",
85
92
  size: 12
86
93
  })
87
- })]
94
+ }) : null]
88
95
  }), /*#__PURE__*/_jsx(Popper, {
89
- open: open && option.options,
96
+ open: open && showChild,
90
97
  anchorEl: open,
91
98
  sx: {
92
99
  zIndex: 9001,
@@ -96,7 +103,7 @@ function DisplayOption({
96
103
  setOpen(null);
97
104
  },
98
105
  placement: "right-start",
99
- children: /*#__PURE__*/_jsx(Box, {
106
+ children: Component ? /*#__PURE__*/_jsx(Component, {}) : /*#__PURE__*/_jsx(Box, {
100
107
  children: /*#__PURE__*/_jsx(CustomSelect, {
101
108
  options: option.options,
102
109
  onSend: onSend,
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from "react";
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { useEditorContext } from "../../hooks/useMouseMove";
3
3
  import Styles from "./Styles";
4
4
  import { Fade, Paper, Popper } from "@mui/material";
@@ -178,9 +178,9 @@ function PopoverAIInput({
178
178
  const selectedEleRef = useRef({});
179
179
  const classes = Styles();
180
180
  const editor = useSlate();
181
- const updateAnchor = () => {
181
+ const updateAnchor = useCallback(() => {
182
182
  updateAnchorEl(setAnchorEl, editor, openAI, selectedEleRef.current);
183
- };
183
+ }, [setAnchorEl, editor, openAI, selectedEleRef.current]);
184
184
  useEditorScroll(editorWrapper, updateAnchor);
185
185
  const onClickOutside = () => {
186
186
  setAnchorEl(null);
@@ -142,7 +142,13 @@ const Styles = theme => ({
142
142
  gap: "8px"
143
143
  },
144
144
  "&:hover": {
145
- background: `${theme?.palette?.containers?.bg3 || "#E9F3FE"}`
145
+ backgroundColor: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`,
146
+ "& svg path": {
147
+ stroke: `${theme?.palette?.editor?.menuOptionTextColor} !important`
148
+ },
149
+ "& svg": {
150
+ color: `${theme?.palette?.editor?.menuOptionTextColor} !important`
151
+ }
146
152
  },
147
153
  "&.active": {
148
154
  background: `${theme?.palette?.containers?.bg3 || "#E9F3FE"}`,
@@ -52,10 +52,13 @@ const Carousel = props => {
52
52
  useEffect(() => {
53
53
  setRefresh(new Date().getTime());
54
54
  }, []);
55
+
56
+ //comment this for carosul selection on insert
55
57
  useEffect(() => {
56
58
  if (!edit) {
57
59
  ReactEditor.focus(editor);
58
60
  Transforms.select(editor, ReactEditor.findPath(editor, element));
61
+ Transforms.deselect(editor);
59
62
  }
60
63
  }, [edit]);
61
64
  const onAddSlide = () => {
@@ -100,11 +100,12 @@ const Divider = props => {
100
100
  };
101
101
  return /*#__PURE__*/_jsxs("div", {
102
102
  ...attributes,
103
- className: `dividerComponent ${readOnly ? 'readonlyDivider' : ''}`,
103
+ className: `dividerComponent`,
104
104
  style: {
105
105
  userSelect: "none",
106
106
  position: 'relative'
107
107
  },
108
+ contentEditable: false,
108
109
  children: [!readOnly && /*#__PURE__*/_jsx("div", {
109
110
  className: `element-root element-selector`,
110
111
  contentEditable: false,
@@ -124,7 +125,8 @@ const Divider = props => {
124
125
  userSelect: "none",
125
126
  borderTop: !borderColor?.includes("linear") ? `${width} ${borderStyle} ${borderColor}` : `transparent`,
126
127
  backgroundImage: borderColor?.includes("linear") ? borderColor : "none",
127
- height: borderColor?.includes("linear") ? borderWidth : undefined
128
+ height: borderColor?.includes("linear") ? borderWidth : undefined,
129
+ marginTop: '15px'
128
130
  }
129
131
  }), /*#__PURE__*/_jsx("span", {
130
132
  style: {
@@ -276,7 +276,7 @@ const FreeGrid = props => {
276
276
  ...insertFreeGridItem("table", {
277
277
  ...DEFAULT_TABLE_NODE()
278
278
  }, {
279
- height: 130,
279
+ height: 150,
280
280
  width: 400
281
281
  })
282
282
  }], {
@@ -21,12 +21,13 @@ const SearchAttachment = props => {
21
21
  const {
22
22
  theme
23
23
  } = useEditorContext();
24
+ const label = Boolean(title?.trim()) ? title : 'Untitled';
24
25
  const handleClick = () => {
25
26
  if (metadata && metadata?.actionHandler) {
26
27
  metadata?.actionHandler(type, element);
27
28
  }
28
29
  };
29
- return /*#__PURE__*/_jsxs(Box, {
30
+ return /*#__PURE__*/_jsx(Box, {
30
31
  component: "div",
31
32
  className: "attachment-wrpr-ev2",
32
33
  ...attributes,
@@ -34,29 +35,31 @@ const SearchAttachment = props => {
34
35
  style: {
35
36
  display: "block"
36
37
  },
37
- children: [/*#__PURE__*/_jsxs(Card, {
38
+ children: /*#__PURE__*/_jsxs(Card, {
38
39
  style: {
39
40
  display: "flex",
40
- justifyContent: "center",
41
- alignItems: "center",
42
- width: "100%",
43
- maxWidth: '200px',
44
- padding: "2px",
41
+ justifyContent: "flex-start",
42
+ alignItems: "flex-end",
43
+ width: "fit-content",
44
+ maxWidth: '194px',
45
+ padding: "0px 10px",
45
46
  boxShadow: "none",
46
- border: `1px solid ${theme?.palette?.primary?.border2}`,
47
- borderRadius: "7px",
48
- background: theme?.palette?.background?.paper,
49
- cursor: 'pointer'
47
+ border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
48
+ borderRadius: "7px !important",
49
+ background: theme?.palette?.containers?.slashBrainCardBg,
50
+ cursor: 'pointer',
51
+ "& *::selection": {
52
+ background: "#000"
53
+ }
50
54
  },
51
55
  onClick: handleClick,
52
56
  children: [/*#__PURE__*/_jsx(CardMedia, {
53
57
  sx: {
54
58
  "& svg": {
55
59
  '& path': {
56
- stroke: '#2563EB'
60
+ stroke: theme?.palette?.text?.slashBrainText
57
61
  }
58
- },
59
- marginTop: '3px'
62
+ }
60
63
  },
61
64
  children: /*#__PURE__*/_jsx(Icon, {
62
65
  icon: "docsIcon"
@@ -64,9 +67,8 @@ const SearchAttachment = props => {
64
67
  }), /*#__PURE__*/_jsx(CardContent, {
65
68
  sx: {
66
69
  display: "flex",
67
- justifyContent: "center",
68
- alignItems: "start",
69
- padding: "3px 5px",
70
+ alignItems: "center",
71
+ padding: "3px 0px 3px 5px",
70
72
  textDecoration: "none",
71
73
  flexDirection: "column",
72
74
  color: "#2563EB",
@@ -74,25 +76,29 @@ const SearchAttachment = props => {
74
76
  paddingBottom: '3px'
75
77
  }
76
78
  },
77
- children: /*#__PURE__*/_jsx(Typography, {
79
+ children: /*#__PURE__*/_jsxs(Typography, {
78
80
  sx: {
79
81
  fontWeight: "500",
80
- color: "#2563EB",
81
- fontSize: "12px",
82
+ background: theme?.palette?.text?.slashBrainText,
83
+ WebkitBackgroundClip: "text",
84
+ WebkitTextFillColor: 'transparent',
85
+ fontSize: "14px",
82
86
  textOverflow: 'ellipsis',
83
87
  whiteSpace: 'nowrap',
84
88
  overflow: 'hidden',
85
89
  wordBreak: "break-word",
86
- maxWidth: '150px'
90
+ maxWidth: '150px',
91
+ lineHeight: 1.43,
92
+ "&::selection": {
93
+ WebkitTextFillColor: "#000"
94
+ }
87
95
  },
88
96
  component: "div",
89
- children: title
97
+ variant: "subtitle1",
98
+ children: [label, children]
90
99
  })
91
100
  })]
92
- }), /*#__PURE__*/_jsx("span", {
93
- contentEditable: false,
94
- children: children
95
- })]
101
+ })
96
102
  });
97
103
  };
98
104
  export default SearchAttachment;
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useImperativeHandle, useState } from "react";
1
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
2
2
  import ToolbarIcon from "../../common/ToolbarIcon";
3
3
  import Icon from "../../common/Icon";
4
4
  import { Paper, Popover } from "@mui/material";
@@ -6,6 +6,7 @@ import { ReactEditor, useSlateStatic } from "slate-react";
6
6
  import SwipeableDrawerComponent from "../../common/SwipeableDrawer";
7
7
  import SearchAndDocList from "./SearchList";
8
8
  import { insertBrain } from "../../utils/brains";
9
+ import { useDebounce } from "use-debounce";
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -22,6 +23,22 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
22
23
  const [target, setTarget] = useState(selectionTarget);
23
24
  const open = Boolean(anchorEl);
24
25
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
26
+ const [mapData, setMapData] = useState([]);
27
+ const [skip, setSkip] = useState(0);
28
+ const [search, setSearch] = useState("");
29
+ const [isLoading, setIsLoading] = useState(false);
30
+ const [debouncedSearch] = useDebounce(search, 300);
31
+ const limit = 20;
32
+ const observer = useRef();
33
+ const lastDocRef = useCallback(node => {
34
+ if (observer.current) observer.current.disconnect();
35
+ observer.current = new IntersectionObserver(entries => {
36
+ if (entries[0].isIntersecting) {
37
+ setSkip(prevSkip => prevSkip + limit);
38
+ }
39
+ });
40
+ if (node) observer.current.observe(node);
41
+ }, []);
25
42
  useImperativeHandle(ref, () => ({
26
43
  triggerClick: target => {
27
44
  setTarget(target);
@@ -42,6 +59,34 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
42
59
  console.log(err);
43
60
  }
44
61
  };
62
+ useEffect(() => {
63
+ getDocs({
64
+ debouncedSearch,
65
+ skip,
66
+ limit
67
+ });
68
+ }, [skip, debouncedSearch]);
69
+ const getDocs = async () => {
70
+ setIsLoading(true);
71
+ try {
72
+ if (otherProps?.services) {
73
+ const result = await otherProps?.services("getDocs", {
74
+ skip,
75
+ limit,
76
+ search
77
+ });
78
+ setMapData(prev => skip === 0 ? result.data : [...prev, ...result.data]);
79
+ }
80
+ } catch (error) {
81
+ console.error("Error fetching documents:", error);
82
+ } finally {
83
+ setIsLoading(false);
84
+ }
85
+ };
86
+ const onSearchChange = value => {
87
+ setSearch(value);
88
+ setSkip(0);
89
+ };
45
90
  const handleClose = () => {
46
91
  setAnchorEl(null);
47
92
  };
@@ -52,9 +97,7 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
52
97
  return /*#__PURE__*/_jsxs(_Fragment, {
53
98
  children: [/*#__PURE__*/_jsx(ToolbarIcon, {
54
99
  title: element?.name,
55
- onClick: () => {
56
- onClick();
57
- },
100
+ onClick: onClick,
58
101
  icon: /*#__PURE__*/_jsx(Icon, {
59
102
  icon: element?.name?.toLowerCase()
60
103
  }),
@@ -71,7 +114,10 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
71
114
  borderColor: theme?.palette?.type === 'dark' ? theme?.palette?.primary?.border2 : 'transparent'
72
115
  },
73
116
  children: /*#__PURE__*/_jsx(SearchAndDocList, {
74
- otherProps: otherProps,
117
+ mapData: mapData,
118
+ isLoading: isLoading,
119
+ lastDocRef: lastDocRef,
120
+ onSearchChange: onSearchChange,
75
121
  handleClick: handleClick,
76
122
  theme: theme,
77
123
  handleClose: handleClose
@@ -88,17 +134,28 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
88
134
  horizontal: "left"
89
135
  },
90
136
  onClose: handleClose,
137
+ sx: {
138
+ '& .MuiPaper-root': {
139
+ borderRadius: '12px !important'
140
+ }
141
+ },
91
142
  children: /*#__PURE__*/_jsx(Paper, {
92
143
  sx: {
93
- padding: "8px",
94
- maxWidth: '330px',
144
+ padding: 0,
145
+ width: '330px',
95
146
  background: theme?.palette?.background?.paper,
96
147
  border: '1px solid',
97
148
  borderColor: theme?.palette?.type === 'dark' ? theme?.palette?.primary?.border2 : 'transparent',
98
- borderRadius: '7px'
149
+ borderRadius: '12px',
150
+ '&.MuiPaper-root-MuiPopover-paper': {
151
+ borderRadius: '12px !important'
152
+ }
99
153
  },
100
154
  children: /*#__PURE__*/_jsx(SearchAndDocList, {
101
- otherProps: otherProps,
155
+ mapData: mapData,
156
+ isLoading: isLoading,
157
+ lastDocRef: lastDocRef,
158
+ onSearchChange: onSearchChange,
102
159
  handleClick: handleClick,
103
160
  theme: theme,
104
161
  handleClose: handleClose