@flozy/editor 5.5.8 → 5.6.0

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 (199) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +26 -13
  3. package/dist/Editor/Editor.css +106 -20
  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 +59 -53
  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 +6 -1
  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 +8 -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 +83 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +180 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +62 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +68 -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 +86 -0
  32. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +71 -0
  33. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +138 -0
  34. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +213 -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 +44 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +146 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +79 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +57 -0
  41. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  42. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +174 -0
  43. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +241 -0
  44. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +45 -0
  45. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +32 -0
  46. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  47. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +217 -0
  48. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +131 -0
  49. package/dist/Editor/Elements/DataView/Layouts/TableView.js +253 -0
  50. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +85 -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 +277 -0
  54. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  55. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +88 -0
  56. package/dist/Editor/Elements/DataView/styles.js +169 -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 +38 -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/Form/Workflow/Styles.js +2 -0
  70. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  71. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -2
  72. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  73. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  74. package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
  75. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  76. package/dist/Editor/Elements/Grid/GridItem.js +47 -36
  77. package/dist/Editor/Elements/Grid/Styles.js +50 -0
  78. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  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 +3 -2
  84. package/dist/Editor/Elements/SimpleText/style.js +15 -0
  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 +21 -2
  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 +8 -8
  106. package/dist/Editor/Toolbar/Mini/Styles.js +9 -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 +547 -58
  111. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +28 -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/ArrowDownIcon.js +25 -0
  116. package/dist/Editor/assets/svg/ArrowUpIcon.js +25 -0
  117. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  118. package/dist/Editor/assets/svg/CalenderIconTick.js +64 -0
  119. package/dist/Editor/assets/svg/ChervDown.js +18 -0
  120. package/dist/Editor/assets/svg/ChervUp.js +18 -0
  121. package/dist/Editor/assets/svg/DataTableIcon.js +50 -0
  122. package/dist/Editor/assets/svg/DuplicateIcon.js +23 -0
  123. package/dist/Editor/assets/svg/EyeIcon.js +23 -0
  124. package/dist/Editor/assets/svg/EyeSlash.js +43 -0
  125. package/dist/Editor/assets/svg/HashtagIcon.js +33 -0
  126. package/dist/Editor/assets/svg/PlusIcon.js +23 -0
  127. package/dist/Editor/assets/svg/SelectRoundedIcon.js +24 -0
  128. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  129. package/dist/Editor/assets/svg/SortByIcon.js +33 -0
  130. package/dist/Editor/assets/svg/TableIcons.js +220 -0
  131. package/dist/Editor/assets/svg/TickOutlined.js +23 -0
  132. package/dist/Editor/assets/svg/TrashCanIcon.js +38 -0
  133. package/dist/Editor/common/ColorPickerButton.js +85 -45
  134. package/dist/Editor/common/DnD/Draggable.js +2 -1
  135. package/dist/Editor/common/FontLoader/FontLoader.js +2 -2
  136. package/dist/Editor/common/Icon.js +54 -21
  137. package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
  138. package/dist/Editor/common/ImageSelector/Styles.js +47 -6
  139. package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
  140. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
  141. package/dist/Editor/common/LinkSettings/index.js +2 -1
  142. package/dist/Editor/common/MentionsPopup/Styles.js +142 -8
  143. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  144. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +107 -12
  145. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  146. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  147. package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
  148. package/dist/Editor/common/RnD/index.js +4 -3
  149. package/dist/Editor/common/Section/index.js +3 -3
  150. package/dist/Editor/common/Section/styles.js +5 -1
  151. package/dist/Editor/common/Select/index.js +20 -0
  152. package/dist/Editor/common/Select/styles.js +17 -0
  153. package/dist/Editor/common/Shorthands/elements.js +13 -1
  154. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
  155. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +4 -3
  156. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +35 -7
  157. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
  158. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
  159. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  160. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
  161. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
  162. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
  163. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
  164. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +20 -4
  165. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -2
  166. package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
  167. package/dist/Editor/common/StyleBuilder/index.js +101 -20
  168. package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
  169. package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
  170. package/dist/Editor/common/ToolbarIcon.js +1 -1
  171. package/dist/Editor/common/Uploader.js +39 -37
  172. package/dist/Editor/common/iconListV2.js +598 -74
  173. package/dist/Editor/common/iconslist.js +25 -19
  174. package/dist/Editor/commonStyle.js +421 -15
  175. package/dist/Editor/helper/deserialize/index.js +31 -2
  176. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  177. package/dist/Editor/helper/index.js +15 -2
  178. package/dist/Editor/helper/theme.js +15 -1
  179. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  180. package/dist/Editor/hooks/useTable.js +210 -0
  181. package/dist/Editor/plugins/withCustomDeleteBackward.js +1 -1
  182. package/dist/Editor/plugins/withEmbeds.js +30 -26
  183. package/dist/Editor/plugins/withHTML.js +100 -12
  184. package/dist/Editor/plugins/withLayout.js +1 -0
  185. package/dist/Editor/utils/SlateUtilityFunctions.js +31 -11
  186. package/dist/Editor/utils/brains.js +1 -1
  187. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +75 -6
  188. package/dist/Editor/utils/customHooks/useResize.js +7 -4
  189. package/dist/Editor/utils/customHooks/useTableResize.js +6 -2
  190. package/dist/Editor/utils/dataView.js +43 -0
  191. package/dist/Editor/utils/embed.js +2 -1
  192. package/dist/Editor/utils/events.js +0 -1
  193. package/dist/Editor/utils/font.js +11 -4
  194. package/dist/Editor/utils/formfield.js +8 -4
  195. package/dist/Editor/utils/helper.js +100 -2
  196. package/dist/Editor/utils/insertNewLine.js +19 -1
  197. package/dist/Editor/utils/serializeToText.js +2 -0
  198. package/dist/Editor/utils/table.js +228 -24
  199. package/package.json +2 -2
@@ -43,6 +43,9 @@ import Code from "../Elements/EmbedScript/Code";
43
43
  import FreeGrid from "../Elements/FreeGrid/FreeGrid";
44
44
  import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
45
45
  import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
46
+ import DataView from "../Elements/DataView/DataView";
47
+ import ViewData from "../Elements/DataView/Layouts/ViewData";
48
+ import ColumnView from "../Elements/DataView/Layouts/ColumnView";
46
49
  import SearchAttachment from "../Elements/Search/SearchAttachment";
47
50
  // import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
48
51
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -152,7 +155,7 @@ export const activeMark = (editor, format) => {
152
155
  const defaultMarkData = {
153
156
  color: "#000000",
154
157
  bgColor: "#FFFFFF",
155
- fontSize: "normal",
158
+ fontSize: "14px",
156
159
  fontFamily: "PoppinsRegular",
157
160
  fontWeight: "normal"
158
161
  };
@@ -167,6 +170,16 @@ export const activeMark = (editor, format) => {
167
170
  };
168
171
  export const getMarked = (leaf, children, theme) => {
169
172
  const className = leaf?.doublequote ? "doublequote" : "";
173
+ if (leaf.highlight) {
174
+ children = /*#__PURE__*/_jsx("span", {
175
+ style: {
176
+ color: "inherit"
177
+ },
178
+ className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
179
+ ,
180
+ children: children
181
+ });
182
+ }
170
183
  if (leaf.bold) {
171
184
  children = /*#__PURE__*/_jsx("strong", {
172
185
  children: children
@@ -237,21 +250,13 @@ export const getMarked = (leaf, children, theme) => {
237
250
  // },
238
251
  ...textStyles,
239
252
  fontFamily: family,
240
- fontWeight: leaf.fontWeight
253
+ fontWeight: leaf.fontWeight,
254
+ WebkitTextFillColor: "unset !important"
241
255
  },
242
256
  children: children
243
257
  })
244
258
  });
245
259
  }
246
- if (leaf.highlight) {
247
- children = /*#__PURE__*/_jsx("span", {
248
- style: {
249
- background: "#EAEBFE",
250
- color: "inherit"
251
- },
252
- children: children
253
- });
254
- }
255
260
  if (leaf.decoration === "link") {
256
261
  children = /*#__PURE__*/_jsx("a", {
257
262
  style: {
@@ -369,12 +374,14 @@ export const getBlock = props => {
369
374
  });
370
375
  case "orderedList":
371
376
  return /*#__PURE__*/_jsx("ol", {
377
+ className: "listItemMargin",
372
378
  type: "1",
373
379
  ...attributes,
374
380
  children: children
375
381
  });
376
382
  case "unorderedList":
377
383
  return /*#__PURE__*/_jsx("ul", {
384
+ className: "listItemMargin",
378
385
  ...attributes,
379
386
  children: children
380
387
  });
@@ -562,6 +569,19 @@ export const getBlock = props => {
562
569
  contentEditable: false,
563
570
  children: children
564
571
  });
572
+ // Data View
573
+ case "dataView":
574
+ return /*#__PURE__*/_jsx(DataView, {
575
+ ...props
576
+ });
577
+ case "viewData":
578
+ return /*#__PURE__*/_jsx(ViewData, {
579
+ ...props
580
+ });
581
+ case "columnView":
582
+ return /*#__PURE__*/_jsx(ColumnView, {
583
+ ...props
584
+ });
565
585
  default:
566
586
  return /*#__PURE__*/_jsx(SimpleText, {
567
587
  ...props,
@@ -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)
@@ -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,90 @@ export const isPageSettings = (event, editor) => {
611
623
  isPageSettingsNode = true;
612
624
  return isPageSettingsNode;
613
625
  }
626
+ };
627
+ export const insertLineBreakAtEndOfPath = (editor, path) => {
628
+ try {
629
+ const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
630
+ if (node) {
631
+ // Insert the line break
632
+ Transforms.insertNodes(editor, {
633
+ type: "paragraph",
634
+ children: [{
635
+ text: ""
636
+ }]
637
+ }, {
638
+ at: nodePath
639
+ });
640
+ }
641
+ } catch (err) {
642
+ console.log(err);
643
+ }
644
+ };
645
+ const omitNodes = ["site-settings", "page-settings"];
646
+ export function getInitialValue(value = [], readOnly) {
647
+ if (readOnly === "readonly" && value?.length) {
648
+ // remove last empty nodes on readonly mode, to remove empty spaces
649
+
650
+ let lastNonEmptyElementIndex;
651
+ for (let i = value?.length; i > 0; i--) {
652
+ const elementIndex = i - 1;
653
+ const node = value[elementIndex];
654
+ if (lastNonEmptyElementIndex) {
655
+ break;
656
+ }
657
+ if (node?.type === "paragraph") {
658
+ // Ensure all children of the paragraph node are text nodes
659
+ const hasOnlyTextChildren = node.children.every(child => Text.isText(child));
660
+ const text = node.children[node.children.length - 1]?.text;
661
+ lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
662
+ } else if (omitNodes.includes(node?.type)) {
663
+ continue;
664
+ } else {
665
+ lastNonEmptyElementIndex = elementIndex;
666
+ }
667
+ }
668
+ const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
669
+ return newValue;
670
+ }
671
+ return value;
672
+ }
673
+ export function capitalizeFirstLetter(str) {
674
+ if (!str) return str;
675
+ return str.charAt(0).toUpperCase() + str.slice(1);
676
+ }
677
+ export function isHavingSelection(editor) {
678
+ try {
679
+ return editor?.selection && !Range.isCollapsed(editor.selection);
680
+ } catch (err) {
681
+ console.log(err);
682
+ }
683
+ }
684
+ export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
685
+ return `${defaultCls} ${selected ? selectedClsName : ""}`;
686
+ }
687
+ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
688
+ try {
689
+ const options = {
690
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === nodeType,
691
+ ...(otherOptions || {})
692
+ };
693
+ const [node, nodePath] = Editor.nodes(editor, options);
694
+ return node ? [node, nodePath] : [];
695
+ } catch (err) {
696
+ console.log(err);
697
+ return [];
698
+ }
699
+ };
700
+ export const containsSurrogatePair = text => {
701
+ // Match surrogate pairs (high and low surrogate)
702
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
703
+ return surrogatePairRegex.test(text);
704
+ };
705
+ export const getSlateDom = (editor, range) => {
706
+ try {
707
+ const slateDom = ReactEditor.toDOMRange(editor, range);
708
+ return slateDom;
709
+ } catch (err) {
710
+ console.log(err);
711
+ }
614
712
  };
@@ -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;
@@ -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] : [];