@flozy/editor 5.4.3 → 5.4.5

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 (192) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +29 -15
  3. package/dist/Editor/Editor.css +104 -19
  4. package/dist/Editor/Elements/AI/AIInput.js +0 -1
  5. package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -52
  7. package/dist/Editor/Elements/AI/Styles.js +24 -6
  8. package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  10. package/dist/Editor/Elements/Button/EditorButton.js +9 -2
  11. package/dist/Editor/Elements/Carousel/CarouselItem.js +11 -3
  12. package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
  13. package/dist/Editor/Elements/Color Picker/Styles.js +7 -3
  14. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  15. package/dist/Editor/Elements/DataView/DataView.js +124 -0
  16. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  17. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  22. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
  23. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  24. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  25. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  26. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  27. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  28. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  29. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  30. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  31. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  32. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  33. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  34. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  41. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  42. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  43. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  44. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  45. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  46. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  47. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  48. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  49. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  50. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
  51. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
  52. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  53. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
  54. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  55. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
  56. package/dist/Editor/Elements/DataView/styles.js +154 -0
  57. package/dist/Editor/Elements/Divider/Divider.js +36 -20
  58. package/dist/Editor/Elements/Embed/Image.js +51 -16
  59. package/dist/Editor/Elements/Embed/Video.js +26 -3
  60. package/dist/Editor/Elements/Form/Form.js +39 -2
  61. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  62. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  63. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  64. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  65. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  66. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  67. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  68. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  69. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  70. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  71. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  72. package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
  73. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  74. package/dist/Editor/Elements/Grid/GridItem.js +47 -36
  75. package/dist/Editor/Elements/Grid/Styles.js +50 -0
  76. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  77. package/dist/Editor/Elements/List/CheckList.js +2 -1
  78. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  79. package/dist/Editor/Elements/Search/SearchButton.js +1 -0
  80. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  81. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  82. package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -52
  83. package/dist/Editor/Elements/SimpleText/index.js +11 -3
  84. package/dist/Editor/Elements/SimpleText/style.js +20 -1
  85. package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
  86. package/dist/Editor/Elements/Table/DragButton.js +142 -0
  87. package/dist/Editor/Elements/Table/DragStyles.js +70 -0
  88. package/dist/Editor/Elements/Table/Draggable.js +25 -0
  89. package/dist/Editor/Elements/Table/Droppable.js +53 -0
  90. package/dist/Editor/Elements/Table/Styles.js +88 -78
  91. package/dist/Editor/Elements/Table/Table.js +263 -140
  92. package/dist/Editor/Elements/Table/TableCell.js +365 -111
  93. package/dist/Editor/Elements/Table/TablePopup.js +9 -3
  94. package/dist/Editor/Elements/Table/TableRow.js +10 -2
  95. package/dist/Editor/Elements/Table/TableTool.js +101 -0
  96. package/dist/Editor/Elements/Table/tableHelper.js +71 -0
  97. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
  98. package/dist/Editor/MiniEditor.js +15 -1
  99. package/dist/Editor/Styles/EditorStyles.js +13 -4
  100. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
  101. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -12
  102. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +26 -4
  103. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
  104. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
  105. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -6
  106. package/dist/Editor/Toolbar/Mini/Styles.js +4 -1
  107. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +7 -3
  108. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +6 -4
  109. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +19 -15
  110. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +555 -57
  111. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +73 -16
  112. package/dist/Editor/Toolbar/PopupTool/index.js +3 -5
  113. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  114. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  115. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  116. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  117. package/dist/Editor/assets/svg/TableIcons.js +220 -0
  118. package/dist/Editor/common/ColorPickerButton.js +85 -45
  119. package/dist/Editor/common/DnD/Draggable.js +2 -1
  120. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  121. package/dist/Editor/common/Icon.js +23 -20
  122. package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
  123. package/dist/Editor/common/ImageSelector/Styles.js +47 -6
  124. package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
  125. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
  126. package/dist/Editor/common/LinkSettings/index.js +2 -1
  127. package/dist/Editor/common/MentionsPopup/Styles.js +143 -8
  128. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  129. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +108 -12
  130. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  131. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  132. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  133. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  134. package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
  135. package/dist/Editor/common/RnD/index.js +3 -2
  136. package/dist/Editor/common/Section/index.js +3 -3
  137. package/dist/Editor/common/Section/styles.js +5 -1
  138. package/dist/Editor/common/Select/index.js +20 -0
  139. package/dist/Editor/common/Select/styles.js +17 -0
  140. package/dist/Editor/common/Shorthands/elements.js +13 -1
  141. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
  142. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +9 -3
  143. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +35 -7
  144. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
  145. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  146. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
  147. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  148. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
  149. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  150. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  151. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
  152. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
  153. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
  154. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +20 -4
  155. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -2
  156. package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
  157. package/dist/Editor/common/StyleBuilder/index.js +101 -20
  158. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  159. package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
  160. package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
  161. package/dist/Editor/common/ToolbarIcon.js +1 -1
  162. package/dist/Editor/common/Uploader.js +46 -36
  163. package/dist/Editor/common/iconListV2.js +616 -60
  164. package/dist/Editor/common/iconslist.js +23 -17
  165. package/dist/Editor/commonStyle.js +417 -11
  166. package/dist/Editor/helper/deserialize/index.js +4 -1
  167. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  168. package/dist/Editor/helper/index.js +17 -4
  169. package/dist/Editor/helper/theme.js +24 -1
  170. package/dist/Editor/hooks/useMouseMove.js +5 -2
  171. package/dist/Editor/hooks/useTable.js +210 -0
  172. package/dist/Editor/plugins/withCustomDeleteBackward.js +36 -4
  173. package/dist/Editor/plugins/withEmbeds.js +30 -26
  174. package/dist/Editor/plugins/withHTML.js +72 -11
  175. package/dist/Editor/plugins/withLayout.js +1 -0
  176. package/dist/Editor/utils/SlateUtilityFunctions.js +39 -12
  177. package/dist/Editor/utils/brains.js +1 -1
  178. package/dist/Editor/utils/button.js +4 -4
  179. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +75 -6
  180. package/dist/Editor/utils/customHooks/useResize.js +7 -4
  181. package/dist/Editor/utils/customHooks/useTableResize.js +6 -2
  182. package/dist/Editor/utils/dataView.js +43 -0
  183. package/dist/Editor/utils/embed.js +2 -1
  184. package/dist/Editor/utils/events.js +0 -1
  185. package/dist/Editor/utils/font.js +11 -4
  186. package/dist/Editor/utils/formfield.js +8 -4
  187. package/dist/Editor/utils/helper.js +103 -2
  188. package/dist/Editor/utils/insertNewLine.js +19 -1
  189. package/dist/Editor/utils/pageSettings.js +14 -2
  190. package/dist/Editor/utils/serializeToText.js +2 -0
  191. package/dist/Editor/utils/table.js +228 -24
  192. package/package.json +2 -2
@@ -18,7 +18,7 @@ export const insertBrain = (editor, data, position) => {
18
18
  };
19
19
  const [currentNode, currentPath] = Editor.node(editor, selection);
20
20
  console.log('W1', Node.string(currentNode));
21
- const cleanedText = Node.string(currentNode).replace(/\/b(?:rain|rai|ra|r)?/g, "").trim();
21
+ const cleanedText = Node.string(currentNode).replace(/\/(?:b(?:rain|rai|ra|r)?)?/g, "").trim();
22
22
  if (cleanedText) {
23
23
  Transforms.delete(editor, {
24
24
  at: Editor.range(editor, currentPath)
@@ -20,10 +20,10 @@ export const insertButton = editor => {
20
20
  bottomRight: 30
21
21
  },
22
22
  bannerSpacing: {
23
- left: 16,
24
- top: 8,
25
- right: 16,
26
- bottom: 8
23
+ left: 24,
24
+ top: 10,
25
+ right: 24,
26
+ bottom: 10
27
27
  },
28
28
  ...(windowVar.lastButtonProps || {})
29
29
  };
@@ -3,6 +3,7 @@ import { Box } from "@mui/material";
3
3
  import { fontFamilyMap, sizeMap } from "../font";
4
4
  import Mentions from "../../Elements/Mentions/Mentions";
5
5
  import CheckList from "../../Elements/List/CheckList";
6
+ import SimpleText from "../../Elements/SimpleText";
6
7
  import { isEmptyTextNode } from "../../helper";
7
8
  import { getBreakPointsValue } from "../../helper/theme";
8
9
  import insertNewLine from "../insertNewLine";
@@ -15,6 +16,20 @@ const LIST_FORMAT_TYPE = {
15
16
  unorderedList: "list-item"
16
17
  };
17
18
  const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
19
+ export const serializeMentions = node => {
20
+ try {
21
+ if (node?.type === 'mention') {
22
+ return [node.character];
23
+ }
24
+ let children = Array.isArray(node) ? node : node?.children;
25
+ children = children && Array.isArray(children) ? children : [];
26
+ let mentions = children.map(child => serializeMentions(child)).flat();
27
+ return mentions.filter(Boolean);
28
+ } catch (err) {
29
+ console.log(err);
30
+ return [];
31
+ }
32
+ };
18
33
  export const toggleBlock = (editor, format, selection = true, attr = {}) => {
19
34
  const isActive = isBlockActive(editor, format);
20
35
  const isList = list_types.includes(format);
@@ -222,38 +237,88 @@ export const getBlock = props => {
222
237
  return /*#__PURE__*/_jsx("p", {
223
238
  ...attributes,
224
239
  ...element.attr,
225
- className: `content-editable ${isEmpty ? "empty" : ""}`
240
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`
226
241
  // placeholder="paragraph"
227
242
  ,
228
243
  children: children
229
244
  });
230
245
  case "headingOne":
231
- return /*#__PURE__*/_jsx("h1", {
246
+ return /*#__PURE__*/_jsx("h3", {
232
247
  ...attributes,
233
248
  ...element.attr,
249
+ style: {
250
+ margin: "10px 0px"
251
+ },
234
252
  className: `content-editable ${isEmpty ? "empty" : ""}`
235
253
  // placeholder="Heading 1"
236
254
  ,
237
255
  children: children
238
256
  });
239
257
  case "headingTwo":
240
- return /*#__PURE__*/_jsx("h2", {
258
+ return /*#__PURE__*/_jsx("h3", {
241
259
  ...attributes,
242
260
  ...element.attr,
261
+ style: {
262
+ margin: "10px 0px"
263
+ },
243
264
  className: `content-editable ${isEmpty ? "empty" : ""}`
244
265
  // placeholder="Heading 2"
245
266
  ,
246
267
  children: children
247
268
  });
269
+ case "title":
270
+ return /*#__PURE__*/_jsx("h3", {
271
+ ...attributes,
272
+ ...element.attr,
273
+ style: {
274
+ margin: "10px 0px"
275
+ },
276
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
277
+ children: children
278
+ });
248
279
  case "headingThree":
249
280
  return /*#__PURE__*/_jsx("h3", {
250
281
  ...attributes,
251
282
  ...element.attr,
283
+ style: {
284
+ margin: "10px 0px"
285
+ },
252
286
  className: `content-editable ${isEmpty ? "empty" : ""}`
253
287
  // placeholder="Heading 3"
254
288
  ,
255
289
  children: children
256
290
  });
291
+ case "headingFour":
292
+ return /*#__PURE__*/_jsx("h4", {
293
+ ...attributes,
294
+ ...element.attr,
295
+ style: {
296
+ margin: "10px 0px"
297
+ },
298
+ className: `content-editable ${isEmpty ? "empty" : ""}`,
299
+ children: children
300
+ });
301
+ case "headingFive":
302
+ return /*#__PURE__*/_jsx("h5", {
303
+ ...attributes,
304
+ ...element.attr,
305
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
306
+ children: children
307
+ });
308
+ case "headingSix":
309
+ return /*#__PURE__*/_jsx("h6", {
310
+ ...attributes,
311
+ ...element.attr,
312
+ className: `content-editable ${isEmpty ? "empty" : ""}`,
313
+ children: children
314
+ });
315
+ case "headingSeven":
316
+ return /*#__PURE__*/_jsx("h7", {
317
+ ...attributes,
318
+ ...element.attr,
319
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
320
+ children: children
321
+ });
257
322
  case "blockquote":
258
323
  return /*#__PURE__*/_jsx("blockquote", {
259
324
  ...attributes,
@@ -305,7 +370,7 @@ export const getBlock = props => {
305
370
  return /*#__PURE__*/_jsx("li", {
306
371
  ...attributes,
307
372
  ...element.attr,
308
- className: `content-editable ${isEmpty ? "empty" : ""}`,
373
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
309
374
  placeholder: "List",
310
375
  style: {
311
376
  color: firstChildren?.color
@@ -322,7 +387,7 @@ export const getBlock = props => {
322
387
  return /*#__PURE__*/_jsx("p", {
323
388
  ...attributes,
324
389
  ...element.attr,
325
- className: `content-editable ${isEmpty ? "empty" : ""}`
390
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`
326
391
  // placeholder="paragraph"
327
392
  ,
328
393
  children: children
@@ -342,6 +407,10 @@ export const getBlock = props => {
342
407
  ...props
343
408
  });
344
409
  default:
345
- return null;
410
+ return /*#__PURE__*/_jsx(SimpleText, {
411
+ ...props,
412
+ isEmpty: isEmpty,
413
+ isChatEditor: true
414
+ });
346
415
  }
347
416
  };
@@ -4,7 +4,10 @@ const useResize = ({
4
4
  parentDOM,
5
5
  size: allSize,
6
6
  isGrid,
7
- onChange
7
+ onChange,
8
+ MH,
9
+ MW,
10
+ MP
8
11
  }) => {
9
12
  const device = getDevice(window.innerWidth);
10
13
  const defaultSize = getBreakPointsValue(allSize);
@@ -52,9 +55,9 @@ const useResize = ({
52
55
  const cWP = calcWidth / width * 100;
53
56
  const calcHeight = (parseInt(currentSize.height) || height) + e.movementY;
54
57
  const calc = {
55
- width: Math.max(calcWidth, 140),
56
- height: Math.max(calcHeight, 50),
57
- widthInPercent: cWP > 100 ? 100 : Math.max(cWP, 15)
58
+ width: Math.max(calcWidth, MW || 140),
59
+ height: Math.max(calcHeight, MH || 50),
60
+ widthInPercent: cWP > 100 ? 100 : Math.max(cWP, MP || 15)
58
61
  };
59
62
  latest = calc;
60
63
  return calc;
@@ -2,7 +2,8 @@ import { useState } from "react";
2
2
  const useTableResize = ({
3
3
  parentDOM,
4
4
  size: defaultSize,
5
- onDone
5
+ onDone,
6
+ minMaxProps = {}
6
7
  }) => {
7
8
  const {
8
9
  width
@@ -38,10 +39,13 @@ const useTableResize = ({
38
39
  setIsDone(1);
39
40
  };
40
41
  const onMouseMove = e => {
42
+ const {
43
+ minWidth
44
+ } = minMaxProps || {};
41
45
  setSize(currentSize => {
42
46
  const calcWidth = currentSize?.width + e.movementX;
43
47
  return {
44
- width: calcWidth,
48
+ width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
45
49
  height: currentSize.height + e.movementY,
46
50
  widthInPercent: calcWidth / width * 100
47
51
  };
@@ -0,0 +1,43 @@
1
+ import { Transforms } from "slate";
2
+ import insertNewLine from "./insertNewLine";
3
+ const getDefaultDatView = () => ({
4
+ type: "dataView",
5
+ title: "",
6
+ layouts: [{
7
+ key: "view1",
8
+ type: "table",
9
+ label: "Table 1 View",
10
+ value: "table1",
11
+ filter: [],
12
+ sort: []
13
+ }],
14
+ properties: [{
15
+ key: "column1",
16
+ label: "Task",
17
+ type: "text",
18
+ visible: true,
19
+ default: true
20
+ }],
21
+ rows: [{
22
+ id: new Date().getTime(),
23
+ column1: ""
24
+ }],
25
+ children: [{
26
+ type: "viewData",
27
+ children: [{
28
+ text: ""
29
+ }]
30
+ }]
31
+ });
32
+ export const insertDataView = editor => {
33
+ try {
34
+ Transforms.insertNodes(editor, {
35
+ ...getDefaultDatView()
36
+ }, {
37
+ at: editor?.selection.focus.path
38
+ });
39
+ insertNewLine(editor);
40
+ } catch (err) {
41
+ console.log(err);
42
+ }
43
+ };
@@ -1,5 +1,5 @@
1
1
  import { Transforms } from "slate";
2
- import insertNewLine from "./insertNewLine";
2
+ import insertNewLine, { insertNewLineAfterCurrentPath } from "./insertNewLine";
3
3
  export const insertDefaultEmbed = (editor, type, defaultURL = "", extProps = {}) => {
4
4
  try {
5
5
  const url = defaultURL ? defaultURL : type === "image" ? "" : "";
@@ -56,6 +56,7 @@ export const insertEmbed = (editor, embedData, format) => {
56
56
  at: editor.selection.anchor.path
57
57
  });
58
58
  insertNewLine(editor);
59
+ insertNewLineAfterCurrentPath(editor);
59
60
  } catch (err) {
60
61
  console.log(err);
61
62
  }
@@ -5,7 +5,6 @@ import { insertAccordion } from "./accordion";
5
5
  import { isListItem } from "./helper";
6
6
  import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
7
7
  import EDITORCMDS from "../common/EditorCmds";
8
- import { ReactEditor } from "slate-react";
9
8
  const HOTKEYS = {
10
9
  b: "bold",
11
10
  i: "italic",
@@ -60,7 +60,14 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
60
60
  };
61
61
  });
62
62
  export const headingMap = {
63
- "headingOne": "32px",
64
- "headingTwo": "24px",
65
- "headingThree": "19px"
66
- };
63
+ headingOne: "32px",
64
+ headingTwo: "24px",
65
+ headingThree: "19px"
66
+ };
67
+ export const fontWeightOptions = [{
68
+ text: "Bold",
69
+ value: "500"
70
+ }, {
71
+ text: "Bolder",
72
+ value: "600"
73
+ }];
@@ -1,5 +1,5 @@
1
1
  import { Transforms } from "slate";
2
- export const formField = () => {
2
+ export const formField = data => {
3
3
  return {
4
4
  type: "form-field",
5
5
  grid: 6,
@@ -12,14 +12,18 @@ export const formField = () => {
12
12
  text: ""
13
13
  }],
14
14
  field_type: "text",
15
- bgColor: "rgba(255, 255, 255, 1)",
16
- borderColor: "#ccc",
15
+ bgColor: data?.bgColor ? data?.bgColor : "rgba(255, 255, 255, 1)",
16
+ borderColor: data?.borderColor ? data?.borderColor : "#ccc",
17
17
  bannerSpacing: {
18
18
  left: 16,
19
19
  right: 16,
20
20
  top: 16,
21
21
  bottom: 16
22
- }
22
+ },
23
+ fontFamily: data?.fontFamily ? data?.fontFamily : "",
24
+ textSize: data?.textSize ? data?.textSize : "",
25
+ textColor: data?.textColor ? data?.textColor : "",
26
+ fontWeight: data?.fontWeight ? data?.fontWeight : "500"
23
27
  };
24
28
  };
25
29
  export const insertGridItem = editor => {
@@ -4,6 +4,7 @@ import insertNewLine from "./insertNewLine";
4
4
  import { getDevice } from "../helper/theme";
5
5
  export const windowVar = {};
6
6
  let ST_TIMEOUT = null;
7
+ const BLOCKS = ["grid", "dataView"];
7
8
  export const formatDate = (date, format = "MM/DD/YYYY") => {
8
9
  if (!date) return "";
9
10
  var d = new Date(date),
@@ -163,7 +164,7 @@ export const handleInsertLastElement = (event, editor) => {
163
164
  if (isFreeGrid) {
164
165
  return;
165
166
  }
166
- const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => c.type === "grid");
167
+ const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => BLOCKS.includes(c.type));
167
168
  if (!ReactEditor.isFocused(editor)) {
168
169
  if (isLastElementEmpty) {
169
170
  if (hasPath) {
@@ -212,7 +213,7 @@ export const isListItem = editor => {
212
213
  });
213
214
  return node;
214
215
  };
215
- const getNode = (editor, path) => {
216
+ export const getNode = (editor, path) => {
216
217
  try {
217
218
  return Node.get(editor, path);
218
219
  } catch (err) {
@@ -264,6 +265,17 @@ export const decodeAndParseBase64 = encodedString => {
264
265
  const jsonData = JSON.parse(decodedURLString);
265
266
  return jsonData;
266
267
  };
268
+ export const encodeToBase64 = data => {
269
+ // Convert the data to a JSON string
270
+ const jsonString = JSON.stringify(data);
271
+
272
+ // URL-encode the JSON string
273
+ const encodedURLString = encodeURIComponent(jsonString);
274
+
275
+ // Base64-encode the URL-encoded string
276
+ const base64EncodedString = btoa(encodedURLString);
277
+ return base64EncodedString;
278
+ };
267
279
  export const hasVerticalScrollbar = (element = {}) => {
268
280
  return element.scrollHeight > element.clientHeight;
269
281
  };
@@ -611,4 +623,93 @@ export const isPageSettings = (event, editor) => {
611
623
  isPageSettingsNode = true;
612
624
  return isPageSettingsNode;
613
625
  }
626
+ };
627
+ export function capitalizeFirstLetter(str) {
628
+ if (!str) return str;
629
+ return str.charAt(0).toUpperCase() + str.slice(1);
630
+ }
631
+ export const insertLineBreakAtEndOfPath = (editor, path) => {
632
+ try {
633
+ const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
634
+ if (node) {
635
+ // Insert the line break
636
+ Transforms.insertNodes(editor, {
637
+ type: "paragraph",
638
+ children: [{
639
+ text: ""
640
+ }]
641
+ }, {
642
+ at: nodePath
643
+ });
644
+ }
645
+ } catch (err) {
646
+ console.log(err);
647
+ }
648
+ };
649
+ export function isHavingSelection(editor) {
650
+ try {
651
+ return editor?.selection && !Range.isCollapsed(editor.selection);
652
+ } catch (err) {
653
+ console.log(err);
654
+ }
655
+ }
656
+ const omitNodes = ["site-settings", "page-settings"];
657
+ export function getInitialValue(value = [], readOnly) {
658
+ if (readOnly === "readonly" && value?.length) {
659
+ // remove last empty nodes on readonly mode, to remove empty spaces
660
+
661
+ let lastNonEmptyElementIndex;
662
+ for (let i = value?.length; i > 0; i--) {
663
+ const elementIndex = i - 1;
664
+ const node = value[elementIndex];
665
+ if (lastNonEmptyElementIndex) {
666
+ break;
667
+ }
668
+ if (node?.type === "paragraph") {
669
+ // Ensure all children of the paragraph node are text nodes
670
+ const hasOnlyTextChildren = node.children.every(child => Text.isText(child));
671
+ const text = node.children[node.children.length - 1]?.text;
672
+ lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
673
+ } else if (omitNodes.includes(node?.type)) {
674
+ continue;
675
+ } else {
676
+ lastNonEmptyElementIndex = elementIndex;
677
+ }
678
+ }
679
+ const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
680
+ return newValue;
681
+ }
682
+ return value;
683
+ }
684
+ export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
685
+ return `${defaultCls} ${selected ? selectedClsName : ""}`;
686
+ }
687
+ export function handleNegativeInteger(val) {
688
+ return val < 0 ? 0 : val;
689
+ }
690
+ export const containsSurrogatePair = text => {
691
+ // Match surrogate pairs (high and low surrogate)
692
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
693
+ return surrogatePairRegex.test(text);
694
+ };
695
+ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
696
+ try {
697
+ const options = {
698
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === nodeType,
699
+ ...(otherOptions || {})
700
+ };
701
+ const [node, nodePath] = Editor.nodes(editor, options);
702
+ return node ? [node, nodePath] : [];
703
+ } catch (err) {
704
+ console.log(err);
705
+ return [];
706
+ }
707
+ };
708
+ export const getSlateDom = (editor, range) => {
709
+ try {
710
+ const slateDom = ReactEditor.toDOMRange(editor, range);
711
+ return slateDom;
712
+ } catch (err) {
713
+ console.log(err);
714
+ }
614
715
  };
@@ -1,4 +1,4 @@
1
- import { Transforms } from "slate";
1
+ import { Editor, Element, Path, Transforms } from "slate";
2
2
  const insertNewLine = editor => {
3
3
  Transforms.insertNodes(editor, {
4
4
  type: "paragraph",
@@ -9,4 +9,22 @@ const insertNewLine = editor => {
9
9
  at: [editor.children.length]
10
10
  });
11
11
  };
12
+ export const insertNewLineAfterCurrentPath = editor => {
13
+ const currentPath = editor?.selection?.anchor?.path;
14
+ const [tableNode] = Editor.nodes(editor, {
15
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
16
+ });
17
+ if (currentPath && tableNode) {
18
+ const currentParentPath = Path.parent(currentPath);
19
+ const nextPath = Path.next(currentParentPath);
20
+ Transforms.insertNodes(editor, {
21
+ type: "paragraph",
22
+ children: [{
23
+ text: ""
24
+ }]
25
+ }, {
26
+ at: nextPath
27
+ });
28
+ }
29
+ };
12
30
  export default insertNewLine;
@@ -9,7 +9,13 @@ export const findPageSettings = editor => {
9
9
  path: null,
10
10
  element: {
11
11
  pageProps: {
12
- pageWidth: "fixed"
12
+ pageWidth: "fixed",
13
+ "lineHeight": {
14
+ "xs": 1.43,
15
+ "sm": 1.43,
16
+ "md": 1.43,
17
+ "lg": 1.43
18
+ }
13
19
  }
14
20
  }
15
21
  };
@@ -34,7 +40,13 @@ export const getPageSettings = editor => {
34
40
  path: null,
35
41
  element: {
36
42
  pageProps: {
37
- pageWidth: "fixed"
43
+ pageWidth: "fixed",
44
+ "lineHeight": {
45
+ "xs": 1.43,
46
+ "sm": 1.43,
47
+ "md": 1.43,
48
+ "lg": 1.43
49
+ }
38
50
  }
39
51
  }
40
52
  };
@@ -2,6 +2,8 @@ export const serializeToText = node => {
2
2
  try {
3
3
  if (!node?.type && node?.text) {
4
4
  return node?.text;
5
+ } else if (node?.type === 'mention') {
6
+ return '@' + node?.character?.name || '';
5
7
  }
6
8
  let n = Array.isArray(node) ? node : node?.children;
7
9
  n = n && Array.isArray(n) ? n : n ? [n] : [];