@flozy/editor 5.5.6 → 5.5.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 (210) hide show
  1. package/dist/Editor/ChatEditor.js +34 -25
  2. package/dist/Editor/CommonEditor.js +16 -33
  3. package/dist/Editor/Editor.css +20 -105
  4. package/dist/Editor/Elements/AI/AIInput.js +1 -0
  5. package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +53 -59
  7. package/dist/Editor/Elements/AI/Styles.js +6 -24
  8. package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  10. package/dist/Editor/Elements/Button/EditorButton.js +2 -9
  11. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
  12. package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
  13. package/dist/Editor/Elements/Color Picker/Styles.js +3 -8
  14. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  15. package/dist/Editor/Elements/Divider/Divider.js +20 -36
  16. package/dist/Editor/Elements/Embed/Image.js +16 -51
  17. package/dist/Editor/Elements/Embed/Video.js +3 -26
  18. package/dist/Editor/Elements/Form/Form.js +2 -39
  19. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
  20. package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
  21. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
  22. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
  23. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
  24. package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
  25. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
  26. package/dist/Editor/Elements/Form/FormPopup.js +9 -12
  27. package/dist/Editor/Elements/Form/Workflow/Styles.js +0 -2
  28. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  29. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -4
  30. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
  31. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  32. package/dist/Editor/Elements/FreeGrid/styles.js +1 -2
  33. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  34. package/dist/Editor/Elements/Grid/GridItem.js +36 -47
  35. package/dist/Editor/Elements/Grid/Styles.js +0 -50
  36. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  37. package/dist/Editor/Elements/List/CheckList.js +1 -2
  38. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  39. package/dist/Editor/Elements/Search/SearchButton.js +0 -1
  40. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  41. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  42. package/dist/Editor/Elements/Signature/SignaturePopup.js +52 -17
  43. package/dist/Editor/Elements/SimpleText/index.js +3 -11
  44. package/dist/Editor/Elements/SimpleText/style.js +1 -20
  45. package/dist/Editor/Elements/Table/Styles.js +78 -88
  46. package/dist/Editor/Elements/Table/Table.js +140 -263
  47. package/dist/Editor/Elements/Table/TableCell.js +111 -365
  48. package/dist/Editor/Elements/Table/TablePopup.js +3 -9
  49. package/dist/Editor/Elements/Table/TableRow.js +2 -10
  50. package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
  51. package/dist/Editor/MiniEditor.js +2 -21
  52. package/dist/Editor/Styles/EditorStyles.js +4 -13
  53. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
  54. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
  55. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
  56. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
  57. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
  58. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
  59. package/dist/Editor/Toolbar/Mini/Styles.js +1 -9
  60. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
  61. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
  62. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
  63. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +58 -557
  64. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -73
  65. package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
  66. package/dist/Editor/Toolbar/Toolbar.js +0 -6
  67. package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
  68. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  69. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  70. package/dist/Editor/common/ColorPickerButton.js +45 -85
  71. package/dist/Editor/common/DnD/Draggable.js +1 -2
  72. package/dist/Editor/common/FontLoader/FontLoader.js +6 -12
  73. package/dist/Editor/common/Icon.js +21 -54
  74. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
  75. package/dist/Editor/common/ImageSelector/Styles.js +6 -47
  76. package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
  77. package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
  78. package/dist/Editor/common/LinkSettings/index.js +1 -2
  79. package/dist/Editor/common/MentionsPopup/Styles.js +8 -143
  80. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  81. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
  82. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  83. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  84. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  85. package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
  86. package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
  87. package/dist/Editor/common/RnD/index.js +3 -4
  88. package/dist/Editor/common/Section/index.js +3 -3
  89. package/dist/Editor/common/Section/styles.js +1 -5
  90. package/dist/Editor/common/Shorthands/elements.js +1 -13
  91. package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -9
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +7 -35
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +2 -15
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +1 -2
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +0 -2
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  100. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +6 -22
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -21
  103. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -20
  104. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -12
  105. package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
  106. package/dist/Editor/common/StyleBuilder/index.js +20 -101
  107. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  108. package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
  109. package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
  110. package/dist/Editor/common/ToolbarIcon.js +1 -1
  111. package/dist/Editor/common/Uploader.js +36 -46
  112. package/dist/Editor/common/iconListV2.js +74 -598
  113. package/dist/Editor/common/iconslist.js +19 -25
  114. package/dist/Editor/commonStyle.js +15 -421
  115. package/dist/Editor/helper/deserialize/index.js +2 -31
  116. package/dist/Editor/helper/index.js +4 -17
  117. package/dist/Editor/helper/theme.js +2 -39
  118. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  119. package/dist/Editor/hooks/useMouseMove.js +2 -5
  120. package/dist/Editor/plugins/withCustomDeleteBackward.js +104 -100
  121. package/dist/Editor/plugins/withEmbeds.js +26 -30
  122. package/dist/Editor/plugins/withHTML.js +12 -100
  123. package/dist/Editor/plugins/withLayout.js +0 -1
  124. package/dist/Editor/utils/SlateUtilityFunctions.js +12 -39
  125. package/dist/Editor/utils/brains.js +1 -1
  126. package/dist/Editor/utils/button.js +4 -4
  127. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +6 -75
  128. package/dist/Editor/utils/customHooks/useResize.js +4 -7
  129. package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
  130. package/dist/Editor/utils/embed.js +1 -2
  131. package/dist/Editor/utils/events.js +1 -0
  132. package/dist/Editor/utils/font.js +4 -11
  133. package/dist/Editor/utils/formfield.js +4 -8
  134. package/dist/Editor/utils/helper.js +2 -103
  135. package/dist/Editor/utils/insertNewLine.js +1 -19
  136. package/dist/Editor/utils/pageSettings.js +2 -14
  137. package/dist/Editor/utils/serializeToText.js +0 -2
  138. package/dist/Editor/utils/table.js +24 -228
  139. package/package.json +2 -2
  140. package/dist/Editor/Elements/DataView/DataView.js +0 -124
  141. package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
  142. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -83
  143. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
  144. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -180
  145. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -62
  146. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -68
  147. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
  148. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
  149. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
  150. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
  151. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
  152. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
  153. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
  154. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
  155. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
  156. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -86
  157. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -71
  158. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -138
  159. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -213
  160. package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
  161. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
  162. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -44
  163. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -146
  164. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -79
  165. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -57
  166. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
  167. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -174
  168. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -241
  169. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -45
  170. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -32
  171. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
  172. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -217
  173. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -131
  174. package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -253
  175. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -85
  176. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
  177. package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
  178. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -277
  179. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
  180. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -88
  181. package/dist/Editor/Elements/DataView/styles.js +0 -169
  182. package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
  183. package/dist/Editor/Elements/Table/DragButton.js +0 -142
  184. package/dist/Editor/Elements/Table/DragStyles.js +0 -70
  185. package/dist/Editor/Elements/Table/Draggable.js +0 -25
  186. package/dist/Editor/Elements/Table/Droppable.js +0 -53
  187. package/dist/Editor/Elements/Table/TableTool.js +0 -101
  188. package/dist/Editor/Elements/Table/tableHelper.js +0 -71
  189. package/dist/Editor/assets/svg/ArrowDownIcon.js +0 -25
  190. package/dist/Editor/assets/svg/ArrowUpIcon.js +0 -25
  191. package/dist/Editor/assets/svg/CalenderIconTick.js +0 -64
  192. package/dist/Editor/assets/svg/ChervDown.js +0 -18
  193. package/dist/Editor/assets/svg/ChervUp.js +0 -18
  194. package/dist/Editor/assets/svg/DataTableIcon.js +0 -50
  195. package/dist/Editor/assets/svg/DuplicateIcon.js +0 -23
  196. package/dist/Editor/assets/svg/EyeIcon.js +0 -23
  197. package/dist/Editor/assets/svg/EyeSlash.js +0 -43
  198. package/dist/Editor/assets/svg/HashtagIcon.js +0 -33
  199. package/dist/Editor/assets/svg/PlusIcon.js +0 -23
  200. package/dist/Editor/assets/svg/SelectRoundedIcon.js +0 -24
  201. package/dist/Editor/assets/svg/SortByIcon.js +0 -33
  202. package/dist/Editor/assets/svg/TableIcons.js +0 -220
  203. package/dist/Editor/assets/svg/TickOutlined.js +0 -23
  204. package/dist/Editor/assets/svg/TrashCanIcon.js +0 -38
  205. package/dist/Editor/common/Select/index.js +0 -20
  206. package/dist/Editor/common/Select/styles.js +0 -17
  207. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  208. package/dist/Editor/helper/enforceDateFormat.js +0 -41
  209. package/dist/Editor/hooks/useTable.js +0 -210
  210. package/dist/Editor/utils/dataView.js +0 -43
@@ -1,26 +1,4 @@
1
1
  import { jsx } from "slate-hyperscript";
2
- const inlineStyles = [{
3
- key: "bold",
4
- getStyle: styles => styles.fontWeight === "bold" || parseInt(styles.fontWeight, 10) >= 700
5
- }, {
6
- key: "italic",
7
- getStyle: styles => styles.fontStyle === "italic"
8
- }, {
9
- key: "underline",
10
- getStyle: styles => styles.textDecoration.includes("underline")
11
- }];
12
- function getInlineTextStyles(element) {
13
- if (!element || !element.style) return {};
14
- const styles = element.style;
15
- const elementStyles = inlineStyles.reduce((total, currVal) => {
16
- const style = currVal.getStyle(styles);
17
- if (style) {
18
- total[currVal.key] = style;
19
- }
20
- return total;
21
- }, {});
22
- return elementStyles;
23
- }
24
2
  const handleTableCell = (el, children) => {
25
3
  const wrapChild = children?.map(c => {
26
4
  if (typeof c === "string") {
@@ -36,10 +14,7 @@ const handleTableCell = (el, children) => {
36
14
  });
37
15
  return {
38
16
  type: "table-cell",
39
- overwriteChild: wrapChild,
40
- size: {
41
- width: 120
42
- }
17
+ overwriteChild: wrapChild
43
18
  };
44
19
  };
45
20
  const INLINE_TAGS = ["A", "ABBR", "B", "BDO", "CITE", "CODE", "DATA", "DEL", "DFN", "IMG", "INS", "KBD", "LABEL", "MARK", "Q", "SAMP", "SMALL", "SPAN", "SUB", "SUP", "TIME", "VAR"];
@@ -160,13 +135,9 @@ const TEXT_TAGS = {
160
135
 
161
136
  const deserialize = el => {
162
137
  if (el.nodeType === 3) {
163
- // if there is any line-breaks
164
138
  const match = /\r|\n/.exec(el.textContent);
165
139
  const text = el.textContent.replace(/\r|\n/g, "").trim();
166
- return match && !text ? null : {
167
- text,
168
- ...getInlineTextStyles(el.parentNode)
169
- };
140
+ return match && !text ? null : el.textContent;
170
141
  } else if (el.nodeType !== 1) {
171
142
  return null;
172
143
  } else if (el.nodeName === "BR") {
@@ -308,13 +308,7 @@ export const getTextColor = (color = "") => {
308
308
  color: "transparent !important",
309
309
  caretColor: "black",
310
310
  "& span": {
311
- color: "transparent !important",
312
- "& ::selection": {
313
- color: "#000 !important"
314
- }
315
- },
316
- "& ::selection": {
317
- color: "#000 !important"
311
+ color: "transparent !important"
318
312
  }
319
313
  } : {
320
314
  color
@@ -337,14 +331,14 @@ export const isCarouselSelected = editor => {
337
331
  return false;
338
332
  }
339
333
  const [nodeEntry] = Editor.nodes(editor, {
340
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
334
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
341
335
  });
342
336
  if (!nodeEntry) {
343
337
  return false;
344
338
  }
345
339
  const [node] = nodeEntry;
346
340
  const carouselDom = ReactEditor.toDOMNode(editor, node);
347
- const isEdit = carouselDom.classList.contains("carousel_slider_edit");
341
+ const isEdit = carouselDom.classList.contains('carousel_slider_edit');
348
342
  return !isEdit;
349
343
  } catch (err) {
350
344
  console.log(err);
@@ -358,7 +352,7 @@ export const clearBrainText = editor => {
358
352
  } = editor;
359
353
  if (selection) {
360
354
  const [currentNode, currentPath] = Editor.node(editor, selection);
361
- const cleanedText = Node.string(currentNode).replace(/\/(?:b(?:rain|rai|ra|r)?)?/g, "").trim();
355
+ const cleanedText = Node.string(currentNode).replace(/\/b(?:rain|rai|ra|r)?/g, "").trim();
362
356
  Transforms.insertText(editor, cleanedText, {
363
357
  at: currentPath
364
358
  });
@@ -366,11 +360,4 @@ export const clearBrainText = editor => {
366
360
  } catch (err) {
367
361
  console.log(err);
368
362
  }
369
- };
370
- export const clearSelectionOnly = editor => {
371
- try {
372
- Transforms.deselect(editor);
373
- } catch (err) {
374
- console.log(err);
375
- }
376
363
  };
@@ -54,20 +54,6 @@ const overrides = {
54
54
  return `${val?.topLeft}px ${val?.topRight}px ${val?.bottomLeft}px ${val?.bottomRight}px`;
55
55
  }
56
56
  };
57
- export const checkXS = (val = {}) => {
58
- try {
59
- if (typeof val === "object") {
60
- if (val?.xs === undefined && val?.lg !== undefined) {
61
- val.xs = val.lg;
62
- }
63
- return val;
64
- }
65
- return val;
66
- } catch (err) {
67
- console.log(err);
68
- return val;
69
- }
70
- };
71
57
  export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) => {
72
58
  try {
73
59
  if (breakpoint) {
@@ -81,7 +67,7 @@ export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) =>
81
67
  return value ? value[breakpoint] || value["lg"] : value;
82
68
  }
83
69
  } else if (typeof value === "object") {
84
- return !breakpoint && value["lg"] ? !ov ? value : checkXS(overrideValues(value, ot)) : value[breakpoint] || copyAllLg(value, ot);
70
+ return !breakpoint && value["lg"] ? !ov ? value : overrideValues(value, ot) : value[breakpoint] || copyAllLg(value, ot);
85
71
  } else {
86
72
  // consider without breakpoints
87
73
  return copyAllLg(value, ot);
@@ -161,27 +147,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
161
147
  }
162
148
  };
163
149
  };
164
- export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
165
- export const getBreakpointLineSpacing = (value, breakpoint) => {
166
- try {
167
- const values = getBreakPointsValue(value, breakpoint);
168
- const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
169
- if (values[b] || values["lg"]) {
170
- const value = values[b] || values["lg"];
171
- return {
172
- ...a,
173
- [b]: value
174
- };
175
- } else {
176
- return a;
177
- }
178
- }, {});
179
- if (breakpoint) {
180
- return value[breakpoint] || value["lg"] || value;
181
- } else {
182
- return cssVal["lg"];
183
- }
184
- } catch (err) {
185
- // console.log(err);
186
- }
187
- };
150
+ export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
@@ -1,6 +1,6 @@
1
1
  import { useMediaQuery } from "@mui/material";
2
2
  export const STIMULATOR_MOCK = {
3
- xs: "@media (min-width: 1200px) and (max-width: 10000px)"
3
+ xs: "@media (min-width: 1200px) and (max-width: 1980px)"
4
4
  };
5
5
  export const isStimulator = () => {
6
6
  try {
@@ -35,7 +35,6 @@ export const EditorProvider = ({
35
35
  path: null
36
36
  });
37
37
  const [fontFamilies, setFontFamilies] = useState({});
38
- const [activeBreakPoint, setActiveBreakPoint] = useState("");
39
38
  useEffect(() => {
40
39
  window.updateSelectedItem = d => {
41
40
  setSelectedElement(d);
@@ -98,10 +97,8 @@ export const EditorProvider = ({
98
97
  setOpenAI,
99
98
  updateDragging,
100
99
  fontFamilies,
101
- setFontFamilies,
102
- activeBreakPoint,
103
- setActiveBreakPoint
104
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
100
+ setFontFamilies
101
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
105
102
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
106
103
  value: otherValues,
107
104
  children: children
@@ -6,124 +6,128 @@ const isNodeTextEmpty = node => {
6
6
  return nodeText.trim() === "";
7
7
  };
8
8
  const withCustomDeleteBackward = editor => {
9
- const {
10
- deleteBackward,
11
- deleteForward
12
- } = editor;
13
-
14
- // Override deleteBackward
15
- editor.deleteBackward = (...args) => {
9
+ try {
16
10
  const {
17
- selection
11
+ deleteBackward,
12
+ deleteForward
18
13
  } = editor;
19
- if (selection) {
20
- // get the current node
21
- const [freeGridItemNode] = Editor.nodes(editor, {
22
- match: n => n.type === "freegridItem" // Adjust based on your list item type
23
- });
24
14
 
25
- // if it is freegrid
26
- if (freeGridItemNode && freeGridItemNode[0]) {
27
- const hasText = Node.string(freeGridItemNode[0]);
28
- if (!hasText) {
29
- return;
15
+ // Override deleteBackward
16
+ editor.deleteBackward = (...args) => {
17
+ const {
18
+ selection
19
+ } = editor;
20
+ if (selection) {
21
+ // get the current node
22
+ const [freeGridItemNode] = Editor.nodes(editor, {
23
+ match: n => n.type === "freegridItem" // Adjust based on your list item type
24
+ });
25
+
26
+ // if it is freegrid
27
+ if (freeGridItemNode && freeGridItemNode[0]) {
28
+ const hasText = Node.string(freeGridItemNode[0]);
29
+ if (!hasText) {
30
+ return;
31
+ }
30
32
  }
31
- }
32
- if (selection && Range.isCollapsed(selection)) {
33
- const [currentNode, path] = Editor.node(editor, selection);
34
- if (currentNode && typeof currentNode.text === 'string') {
35
- const text = currentNode.text;
36
- if (containsSurrogatePair(text)) {
37
- // Check if the cursor is at the end of a surrogate pair
38
- const {
39
- offset
40
- } = selection.anchor;
41
- const beforeCursor = text.slice(0, offset);
42
- const afterCursor = text.slice(offset);
43
- if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
44
- // Delete the entire surrogate pair
45
- Transforms.delete(editor, {
46
- at: {
47
- anchor: {
48
- path,
49
- offset: offset - 2
50
- },
51
- // Move back 2 for surrogate pair
52
- focus: {
53
- path,
54
- offset
33
+ if (selection && Range.isCollapsed(selection)) {
34
+ const [currentNode, path] = Editor.node(editor, selection);
35
+ if (currentNode && typeof currentNode.text === 'string') {
36
+ const text = currentNode.text;
37
+ if (containsSurrogatePair(text)) {
38
+ // Check if the cursor is at the end of a surrogate pair
39
+ const {
40
+ offset
41
+ } = selection.anchor;
42
+ const beforeCursor = text.slice(0, offset);
43
+ const afterCursor = text.slice(offset);
44
+ if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
45
+ // Delete the entire surrogate pair
46
+ Transforms.delete(editor, {
47
+ at: {
48
+ anchor: {
49
+ path,
50
+ offset: offset - 2
51
+ },
52
+ // Move back 2 for surrogate pair
53
+ focus: {
54
+ path,
55
+ offset
56
+ }
55
57
  }
56
- }
57
- });
58
- return;
58
+ });
59
+ return;
60
+ }
59
61
  }
60
62
  }
61
63
  }
62
- }
63
64
 
64
- // Check if current node is a list item and is the last one, signature node
65
- const [node] = Editor.nodes(editor, {
66
- match: n => BACKWARD_BLOCKS.includes(n.type) // Adjust based on your list item type
67
- });
65
+ // Check if current node is a list item and is the last one, signature node
66
+ const [node] = Editor.nodes(editor, {
67
+ match: n => BACKWARD_BLOCKS?.includes(n.type) // Adjust based on your list item type
68
+ });
68
69
 
69
- if (node) {
70
- // Check if it is the last list item is empty text
71
- const parentNodePath = Path.parent(node[1]);
72
- const isLastChildren = Node.get(editor, parentNodePath);
73
- const isEmpty = isNodeTextEmpty(node[0]) && isLastChildren?.children?.length === 1;
74
- if (isEmpty) {
75
- Transforms.setNodes(editor, {
76
- type: "paragraph"
77
- }, {
78
- at: parentNodePath
79
- });
80
- Transforms.removeNodes(editor, {
81
- at: node[1]
82
- });
83
- return;
70
+ if (node) {
71
+ // Check if it is the last list item is empty text
72
+ const parentNodePath = Path.parent(node[1]);
73
+ const isLastChildren = Node.get(editor, parentNodePath);
74
+ const isEmpty = isNodeTextEmpty(node[0]) && isLastChildren?.children?.length === 1;
75
+ if (isEmpty) {
76
+ Transforms.setNodes(editor, {
77
+ type: "paragraph"
78
+ }, {
79
+ at: parentNodePath
80
+ });
81
+ Transforms.removeNodes(editor, {
82
+ at: node[1]
83
+ });
84
+ return;
85
+ }
84
86
  }
85
87
  }
86
- }
87
88
 
88
- // Fall back to default delete behavior if conditions are not met
89
- deleteBackward(...args);
90
- };
91
- editor.deleteForward = (...args) => {
92
- const {
93
- selection
94
- } = editor;
95
- if (selection) {
89
+ // Fall back to default delete behavior if conditions are not met
90
+ deleteBackward(...args);
91
+ };
92
+ editor.deleteForward = (...args) => {
96
93
  const {
97
- nextPath,
98
- nextNode
99
- } = getNextNode(editor) || {};
94
+ selection
95
+ } = editor;
96
+ if (selection) {
97
+ const {
98
+ nextPath,
99
+ nextNode
100
+ } = getNextNode(editor) || {};
100
101
 
101
- // Restrict deletion of page-settings
102
- if (nextNode?.type === "page-settings") {
103
- const isEndLine = Point.equals(selection.focus, Editor.end(editor, selection.focus.path));
104
- if (isEndLine) {
105
- const lastEditorChild = editor?.children?.length;
106
- const isLastNode = lastEditorChild - 1 === nextPath[0];
107
- if (isLastNode) {
108
- return;
109
- }
102
+ // Restrict deletion of page-settings
103
+ if (nextNode?.type === "page-settings") {
104
+ const isEndLine = Point.equals(selection.focus, Editor.end(editor, selection.focus.path));
105
+ if (isEndLine) {
106
+ const lastEditorChild = editor?.children?.length;
107
+ const isLastNode = lastEditorChild - 1 === nextPath[0];
108
+ if (isLastNode) {
109
+ return;
110
+ }
110
111
 
111
- // move the page-settings node to last
112
- Transforms.moveNodes(editor, {
113
- at: nextPath,
114
- to: [lastEditorChild]
115
- });
112
+ // move the page-settings node to last
113
+ Transforms.moveNodes(editor, {
114
+ at: nextPath,
115
+ to: [lastEditorChild]
116
+ });
116
117
 
117
- // Node present after page-settings, will now merged to current node
118
- Transforms.mergeNodes(editor, {
119
- at: nextPath
120
- });
121
- return;
118
+ // Node present after page-settings, will now merged to current node
119
+ Transforms.mergeNodes(editor, {
120
+ at: nextPath
121
+ });
122
+ return;
123
+ }
122
124
  }
123
125
  }
124
- }
125
- deleteForward(...args);
126
- };
127
- return editor;
126
+ deleteForward(...args);
127
+ };
128
+ return editor;
129
+ } catch (err) {
130
+ console.log(err);
131
+ }
128
132
  };
129
133
  export default withCustomDeleteBackward;
@@ -40,36 +40,32 @@ const withEmbeds = editor => {
40
40
  }
41
41
  };
42
42
  editor.insertBreak = (...args) => {
43
- try {
44
- const parentPath = Path.parent(editor.selection.focus.path);
45
- const parentNode = Node.get(editor, parentPath);
46
- if (editor.isVoid(parentNode)) {
47
- const nextPath = Path.next(parentPath);
48
- Transforms.insertNodes(editor, {
49
- type: "paragraph",
50
- children: [{
51
- text: ""
52
- }]
53
- }, {
54
- at: nextPath,
55
- select: true // Focus on this node once inserted
56
- });
57
- } else if (AvoidCopying.indexOf(parentNode?.type) >= 0) {
58
- const nextPath = Path.next(parentPath);
59
- Transforms.insertNodes(editor, {
60
- type: "paragraph",
61
- children: [{
62
- text: ""
63
- }]
64
- }, {
65
- at: nextPath,
66
- select: true // Focus on this node once inserted
67
- });
68
- } else {
69
- insertBreak(...args);
70
- }
71
- } catch (err) {
72
- console.log(err);
43
+ const parentPath = Path.parent(editor.selection.focus.path);
44
+ const parentNode = Node.get(editor, parentPath);
45
+ if (editor.isVoid(parentNode)) {
46
+ const nextPath = Path.next(parentPath);
47
+ Transforms.insertNodes(editor, {
48
+ type: "paragraph",
49
+ children: [{
50
+ text: ""
51
+ }]
52
+ }, {
53
+ at: nextPath,
54
+ select: true // Focus on this node once inserted
55
+ });
56
+ } else if (AvoidCopying.indexOf(parentNode?.type) >= 0) {
57
+ const nextPath = Path.next(parentPath);
58
+ Transforms.insertNodes(editor, {
59
+ type: "paragraph",
60
+ children: [{
61
+ text: ""
62
+ }]
63
+ }, {
64
+ at: nextPath,
65
+ select: true // Focus on this node once inserted
66
+ });
67
+ } else {
68
+ insertBreak(...args);
73
69
  }
74
70
  };
75
71
  return editor;
@@ -2,45 +2,6 @@ import { Transforms, Editor, Element, Node, Path } from "slate";
2
2
  import deserialize from "../helper/deserialize";
3
3
  import { decodeAndParseBase64 } from "../utils/helper";
4
4
  const avoidDefaultInsert = ["table", "grid"];
5
- const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
6
- const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
7
- const parseCopiedHTML = html => {
8
- const parsed = new DOMParser().parseFromString(html, "text/html");
9
-
10
- // if ol, ul are inside li, remove and push ol,ul after that li to maintain format between our slate list and external source list's json
11
- parsed.querySelectorAll("li > ul, li > ol").forEach(list => {
12
- // Find the parent li
13
- const parentLi = list.parentElement;
14
-
15
- // Move the list after the parent li
16
- parentLi.after(list);
17
- });
18
-
19
- // to handle google docs list
20
- parsed.querySelectorAll("li p, li div").forEach(element => {
21
- const parent = element.parentNode;
22
- // Move all child nodes of <p> or <div> to its parent <li>
23
- while (element.firstChild) {
24
- parent.insertBefore(element.firstChild, element);
25
- }
26
- // Remove the <p> or <div> element
27
- parent.removeChild(element);
28
- });
29
-
30
- // claude.ai, copy list inbetween, some li tags are not wrapped with ul or ol
31
- parsed.querySelectorAll("li").forEach(li => {
32
- // Check if the parent of <li> is not a <ul> or <ol>
33
- if (!li.parentElement || li.parentElement.tagName !== "UL" && li.parentElement.tagName !== "OL") {
34
- // Create a <ul> element
35
- const ul = document.createElement("ul");
36
- // Append the <li> to the <ul>
37
- ul.appendChild(li.cloneNode(true)); // Clone the <li>
38
- // Replace the original <li> in the DOM with the <ul>
39
- li.replaceWith(ul);
40
- }
41
- });
42
- return parsed;
43
- };
44
5
  const loopChildren = (children = [], defaultInsert) => {
45
6
  if (!children?.length) {
46
7
  return defaultInsert;
@@ -65,7 +26,7 @@ const getCurrentElement = editor => {
65
26
  return null;
66
27
  }
67
28
  };
68
- export const getCurrentElementText = editor => {
29
+ const getCurrentElementText = editor => {
69
30
  try {
70
31
  if (editor.selection) {
71
32
  return Editor.string(editor, editor?.selection?.anchor?.path);
@@ -100,23 +61,12 @@ const insertAtNextNode = (editor, formattedFragment) => {
100
61
  console.log(err);
101
62
  }
102
63
  };
103
-
104
- // const handleInsert = (editor, defaultInsert, fragment = []) => {
105
- // if (
106
- // getCurrentElementText(editor) &&
107
- // fragment.some((f) => f.type === "table")
108
- // ) {
109
- // insertAtNextNode(editor, fragment);
110
- // } else {
111
- // defaultInsert();
112
- // }
113
- // };
114
-
115
- const getTableCellChild = (fragment = []) => {
116
- const table = fragment.find(node => node.type === "table");
117
- const row = table?.children?.find(node => node.type === "table-row");
118
- const cell = row?.children?.find(node => node.type === "table-cell");
119
- return cell?.children || [];
64
+ const handleInsert = (editor, defaultInsert, fragment = []) => {
65
+ if (getCurrentElementText(editor) && fragment.some(f => f.type === "table")) {
66
+ insertAtNextNode(editor, fragment);
67
+ } else {
68
+ defaultInsert();
69
+ }
120
70
  };
121
71
  const formatFragment = {
122
72
  "list-item": fragment => {
@@ -165,21 +115,8 @@ const withHtml = editor => {
165
115
  const html = data?.getData("text/html");
166
116
  const currentEl = getCurrentElement(editor);
167
117
  const eltype = currentEl?.type;
168
- const firstNode = editor?.children?.[0];
169
- const titlePath = firstNode?.type === "topbanner" ? 1 : 0;
170
- const isTitlePath = editor.needLayout && editor?.selection?.anchor?.path[0] === titlePath;
171
118
  if (slateHTML && !formatFragment[eltype]) {
172
- const [tableCellNode] = Editor.nodes(editor, {
173
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
174
- });
175
119
  const decoded = decodeAndParseBase64(slateHTML);
176
- if (tableCellNode) {
177
- const tableCellChild = getTableCellChild(decoded);
178
- if (tableCellChild?.length) {
179
- Transforms.insertFragment(editor, tableCellChild);
180
- return;
181
- }
182
- }
183
120
  const tableNode = getFocusedNode(editor, "table");
184
121
  const onlyTextNode = getFocusedNode(editor, "freegrid");
185
122
 
@@ -217,38 +154,22 @@ const withHtml = editor => {
217
154
  Transforms.insertText(editor, text);
218
155
  }
219
156
  } else {
220
- const isTextNode = ALLOWED_TEXT_NODES.includes(decoded?.[0]?.type);
221
- if (isTitlePath && !isTextNode) {
222
- insertAtNextNode(editor, decoded);
223
- return;
224
- }
225
- const currentText = getCurrentElementText(editor);
226
- if (currentText?.trim() && !isTextNode) {
227
- insertAtNextNode(editor, decoded);
228
- return;
229
- }
230
- insertData(data);
157
+ handleInsert(editor, () => insertData(data), decoded);
231
158
  }
232
159
  } else if (html) {
233
- const parsed = parseCopiedHTML(html);
234
- const rootElement = parsed.body;
235
- const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
160
+ const parsed = new DOMParser().parseFromString(html, "text/html");
236
161
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
237
162
  if (isGoogleSheet) {
238
163
  if (editor.isChatEditor) {
239
164
  return;
240
165
  }
241
- const table = rootElement.querySelector("table");
166
+ const table = parsed.body.querySelector("table");
242
167
  const colGrp = table.querySelector("colgroup");
243
168
  if (colGrp) {
244
169
  colGrp.remove();
245
170
  }
246
171
  const fragment = deserialize(table);
247
- if (isTitlePath) {
248
- insertAtNextNode(editor, [fragment]);
249
- } else {
250
- Transforms.insertFragment(editor, [fragment]);
251
- }
172
+ Transforms.insertFragment(editor, [fragment]);
252
173
  return;
253
174
  }
254
175
  const fragment = deserialize(parsed.body);
@@ -262,16 +183,7 @@ const withHtml = editor => {
262
183
  if (editor.isChatEditor && is_img_table) {
263
184
  return;
264
185
  }
265
- if (isTitlePath && isNonText) {
266
- insertAtNextNode(editor, formattedFragment);
267
- return;
268
- }
269
- const currentText = getCurrentElementText(editor);
270
- if (currentText?.trim() && isNonText) {
271
- insertAtNextNode(editor, formattedFragment);
272
- return;
273
- }
274
- Transforms.insertFragment(editor, formattedFragment);
186
+ handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
275
187
  return;
276
188
  } else {
277
189
  insertData(data);
@@ -58,7 +58,6 @@ const withLayout = editor => {
58
58
  Transforms.insertNodes(editor, paragraph, {
59
59
  at: path.concat(1)
60
60
  });
61
- return;
62
61
  }
63
62
  ORDERS_LAYOUT.forEach((enforce, index) => {
64
63
  if (index < editor.children.length) {