@flozy/editor 5.3.6 → 5.3.8

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 (102) hide show
  1. package/dist/Editor/ChatEditor.js +34 -25
  2. package/dist/Editor/CommonEditor.js +8 -16
  3. package/dist/Editor/Editor.css +11 -57
  4. package/dist/Editor/Elements/AI/AIInput.js +1 -0
  5. package/dist/Editor/Elements/AI/CustomSelect.js +11 -19
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +4 -9
  7. package/dist/Editor/Elements/AI/Styles.js +5 -17
  8. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
  9. package/dist/Editor/Elements/Color Picker/ColorButtons.js +3 -3
  10. package/dist/Editor/Elements/Color Picker/Styles.js +3 -7
  11. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  12. package/dist/Editor/Elements/Divider/Divider.js +15 -16
  13. package/dist/Editor/Elements/Embed/Image.js +7 -23
  14. package/dist/Editor/Elements/Embed/Video.js +1 -13
  15. package/dist/Editor/Elements/Form/Form.js +2 -38
  16. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
  17. package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
  18. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
  19. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
  20. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
  21. package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
  22. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
  23. package/dist/Editor/Elements/Form/FormPopup.js +9 -12
  24. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
  26. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  27. package/dist/Editor/Elements/Grid/GridItem.js +36 -45
  28. package/dist/Editor/Elements/Grid/Styles.js +0 -6
  29. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  30. package/dist/Editor/Elements/Search/SearchButton.js +0 -1
  31. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  32. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  33. package/dist/Editor/Elements/Signature/SignaturePopup.js +48 -13
  34. package/dist/Editor/Elements/SimpleText/style.js +0 -10
  35. package/dist/Editor/Elements/Table/Styles.js +79 -82
  36. package/dist/Editor/Elements/Table/Table.js +140 -260
  37. package/dist/Editor/Elements/Table/TableCell.js +103 -362
  38. package/dist/Editor/Elements/Table/TablePopup.js +3 -9
  39. package/dist/Editor/Elements/Table/TableRow.js +2 -10
  40. package/dist/Editor/Styles/EditorStyles.js +1 -8
  41. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
  42. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
  43. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -10
  44. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
  45. package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -0
  46. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +6 -3
  47. package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
  48. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -3
  49. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
  50. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +49 -409
  51. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -17
  52. package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
  53. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  54. package/dist/Editor/common/ColorPickerButton.js +44 -82
  55. package/dist/Editor/common/Icon.js +20 -17
  56. package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
  57. package/dist/Editor/common/LinkSettings/index.js +1 -2
  58. package/dist/Editor/common/MentionsPopup/Styles.js +8 -156
  59. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -107
  61. package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
  62. package/dist/Editor/common/RnD/index.js +1 -1
  63. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +4 -8
  64. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +7 -7
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -5
  66. package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
  67. package/dist/Editor/common/StyleBuilder/index.js +11 -84
  68. package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
  69. package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
  70. package/dist/Editor/common/iconListV2.js +40 -378
  71. package/dist/Editor/common/iconslist.js +14 -17
  72. package/dist/Editor/commonStyle.js +10 -130
  73. package/dist/Editor/helper/deserialize/index.js +20 -27
  74. package/dist/Editor/helper/index.js +1 -1
  75. package/dist/Editor/plugins/withCustomDeleteBackward.js +2 -3
  76. package/dist/Editor/plugins/withHTML.js +10 -61
  77. package/dist/Editor/plugins/withLayout.js +0 -1
  78. package/dist/Editor/utils/SlateUtilityFunctions.js +0 -2
  79. package/dist/Editor/utils/brains.js +1 -1
  80. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -26
  81. package/dist/Editor/utils/customHooks/useResize.js +4 -7
  82. package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
  83. package/dist/Editor/utils/embed.js +1 -2
  84. package/dist/Editor/utils/events.js +1 -0
  85. package/dist/Editor/utils/font.js +4 -11
  86. package/dist/Editor/utils/formfield.js +4 -8
  87. package/dist/Editor/utils/helper.js +2 -55
  88. package/dist/Editor/utils/insertNewLine.js +1 -19
  89. package/dist/Editor/utils/serializeToText.js +0 -2
  90. package/dist/Editor/utils/table.js +24 -228
  91. package/package.json +1 -1
  92. package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
  93. package/dist/Editor/Elements/Table/DragButton.js +0 -142
  94. package/dist/Editor/Elements/Table/DragStyles.js +0 -70
  95. package/dist/Editor/Elements/Table/Draggable.js +0 -25
  96. package/dist/Editor/Elements/Table/Droppable.js +0 -53
  97. package/dist/Editor/Elements/Table/TableTool.js +0 -101
  98. package/dist/Editor/Elements/Table/tableHelper.js +0 -71
  99. package/dist/Editor/assets/svg/TableIcons.js +0 -220
  100. package/dist/Editor/common/Select/index.js +0 -20
  101. package/dist/Editor/common/Select/styles.js +0 -17
  102. package/dist/Editor/hooks/useTable.js +0 -207
@@ -1,20 +0,0 @@
1
- import { Select as Core } from "@mui/material";
2
- import SelectStyles from "./styles";
3
- import { useEditorContext } from "../../hooks/useMouseMove";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- function Select(props) {
6
- const {
7
- children,
8
- ...rest
9
- } = props;
10
- const {
11
- theme
12
- } = useEditorContext();
13
- const classes = SelectStyles(theme);
14
- return /*#__PURE__*/_jsx(Core, {
15
- MenuProps: classes.MenuProps,
16
- ...rest,
17
- children: children
18
- });
19
- }
20
- export default Select;
@@ -1,17 +0,0 @@
1
- const SelectStyles = (theme = {}) => {
2
- const {
3
- textColor,
4
- background
5
- } = theme?.palette?.editor || {};
6
- return {
7
- MenuProps: {
8
- PaperProps: {
9
- sx: {
10
- color: textColor,
11
- background
12
- }
13
- }
14
- }
15
- };
16
- };
17
- export default SelectStyles;
@@ -1,207 +0,0 @@
1
- import { ClickAwayListener } from "@mui/material";
2
- import { createContext, useContext, useEffect, useMemo, useState } from "react";
3
- import { clearCellText } from "../utils/table";
4
- import { Editor, Element, Transforms } from "slate";
5
- import { DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
6
- import { encodeToBase64, isHavingSelection } from "../utils/helper";
7
- import { serializeToText } from "../utils/serializeToText";
8
- import { createCopiedTableStructure, getRectangleBounds, tableNodeToDom } from "../Elements/Table/tableHelper";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- const selectFirstCell = (tablePath, editor, updateTableSelection) => {
12
- const firstCell = [...tablePath, 0, 0];
13
- const end = Editor.end(editor, firstCell);
14
- Transforms.select(editor, {
15
- anchor: end,
16
- focus: end
17
- });
18
- updateTableSelection({
19
- startCellPath: firstCell,
20
- endCellPath: [],
21
- isDragging: false
22
- });
23
- };
24
- const handleDragEnd = (dragData, editor, resetAll) => {
25
- const {
26
- active,
27
- over
28
- } = dragData;
29
- if (over) {
30
- const {
31
- dragType,
32
- path: startCellPath
33
- } = active?.data?.current || {};
34
- const {
35
- path: overCellPath
36
- } = over?.data?.current || {};
37
- if (startCellPath?.length) {
38
- if (dragType === "row") {
39
- const startRowPath = startCellPath.slice(0, -1);
40
- const overRowPath = overCellPath.slice(0, -1);
41
- Transforms.moveNodes(editor, {
42
- at: startRowPath,
43
- to: overRowPath
44
- });
45
- } else {
46
- const [startCol] = startCellPath.slice(-1);
47
- const [overCol] = overCellPath.slice(-1);
48
- const [tableData] = Editor.nodes(editor, {
49
- at: startCellPath,
50
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
51
- });
52
- const [tableNode, tablePath] = tableData;
53
- const rows = tableNode?.rows || 0;
54
- for (let row = 0; row < rows; row++) {
55
- const startColPath = [...tablePath, row, startCol];
56
- const overColPath = [...tablePath, row, overCol];
57
- Transforms.moveNodes(editor, {
58
- at: startColPath,
59
- to: overColPath
60
- });
61
- }
62
- }
63
- resetAll();
64
- }
65
- }
66
- };
67
- const TableContext = /*#__PURE__*/createContext();
68
- export function getDefaultTableSelection() {
69
- return {
70
- startCellPath: [],
71
- endCellPath: [],
72
- isDragging: false
73
- };
74
- }
75
- export const TableProvider = ({
76
- editor,
77
- children,
78
- otherProps = {}
79
- }) => {
80
- const {
81
- tablePath
82
- } = otherProps;
83
- const [hoverPath, setHoverPath] = useState(null);
84
- const [tableSelection, setTableSelection] = useState(getDefaultTableSelection());
85
- const [tableResizing, setTableResizing] = useState(null);
86
-
87
- // for the button events (like onclick,...etc) inside draggable component to work correctly
88
- const sensors = useSensors(useSensor(PointerSensor, {
89
- activationConstraint: {
90
- delay: 250,
91
- distance: 0 // throws exceeded distance error
92
- }
93
- }));
94
-
95
- const getSelectedCells = () => {
96
- return getRectangleBounds(tableSelection);
97
- };
98
- const updateTableSelection = update => {
99
- setTableSelection(prev => ({
100
- ...prev,
101
- ...update
102
- }));
103
- };
104
- const resetAll = () => {
105
- setTableSelection(getDefaultTableSelection());
106
- Transforms.deselect(editor);
107
-
108
- // hide drag icons after drag completion
109
- setTimeout(() => setHoverPath(null), 200);
110
- };
111
- const values = useMemo(() => {
112
- return {
113
- hoverPath,
114
- setHoverPath,
115
- editor,
116
- getSelectedCells,
117
- updateTableSelection,
118
- tableSelection,
119
- tableResizing,
120
- setTableResizing,
121
- otherProps,
122
- resetAll
123
- };
124
- }, [hoverPath, editor?.selection, tableSelection, tableResizing]);
125
- useEffect(() => {
126
- let isTextSelected;
127
- const handleKeyDown = event => {
128
- const isCutKey = (event.ctrlKey || event.metaKey) && event.key === "x";
129
- if (isCutKey) {
130
- isTextSelected = isHavingSelection(editor);
131
- } else if (event.key === "Backspace") {
132
- const selectedCells = getSelectedCells();
133
- if (selectedCells?.length > 1) {
134
- selectedCells.forEach(currentCellPath => {
135
- clearCellText(editor, currentCellPath);
136
- });
137
- }
138
- }
139
- };
140
- const handleCopy = (event, isCut) => {
141
- try {
142
- const isTextSelected = isHavingSelection(editor);
143
- const {
144
- startCellPath
145
- } = tableSelection || {};
146
- const customCopy = startCellPath?.length;
147
- if (customCopy && !isTextSelected) {
148
- event.preventDefault(); // Prevent default copy behavior
149
-
150
- const {
151
- tablePath
152
- } = otherProps;
153
- const [node] = Editor.node(editor, tablePath);
154
- const copiedTableNode = createCopiedTableStructure(editor, tableSelection, node, tablePath);
155
- const tableNode = [copiedTableNode];
156
- const encodedTableNode = encodeToBase64(tableNode);
157
- event.clipboardData.setData("application/x-slate-fragment", encodedTableNode);
158
- const textData = serializeToText(tableNode);
159
- event.clipboardData.setData("text/plain", textData);
160
- const tableDom = tableNodeToDom(copiedTableNode);
161
- event.clipboardData.setData("text/html", tableDom?.outerHTML);
162
- if (isCut) {
163
- clearCellText(editor, startCellPath);
164
- }
165
- }
166
- } catch (err) {
167
- console.log(err);
168
- }
169
- };
170
- const handleCut = e => {
171
- // unable to find the text selected or not here, that why handling it on handleKeyDown
172
-
173
- if (!isTextSelected) {
174
- e.preventDefault();
175
- handleCopy(e, true);
176
- }
177
- };
178
- window.addEventListener("keydown", handleKeyDown);
179
- window.addEventListener("copy", handleCopy);
180
- window.addEventListener("cut", handleCut);
181
- return () => {
182
- window.removeEventListener("keydown", handleKeyDown);
183
- window.removeEventListener("copy", handleCopy);
184
- window.removeEventListener("cut", handleCut);
185
- };
186
- }, [tableSelection, editor, tableSelection]);
187
- useEffect(() => {
188
- selectFirstCell(tablePath, editor, updateTableSelection);
189
- }, []);
190
- return /*#__PURE__*/_jsx(TableContext.Provider, {
191
- value: values,
192
- children: /*#__PURE__*/_jsxs(DndContext, {
193
- sensors: sensors,
194
- onDragEnd: data => handleDragEnd(data, editor, resetAll),
195
- children: [/*#__PURE__*/_jsx(ClickAwayListener, {
196
- onClickAway: () => setTableSelection(getDefaultTableSelection()),
197
- children: /*#__PURE__*/_jsx("div", {
198
- children: children
199
- })
200
- }), /*#__PURE__*/_jsx(DragOverlay, {})]
201
- })
202
- });
203
- };
204
- function useTable() {
205
- return useContext(TableContext);
206
- }
207
- export default useTable;