@flozy/editor 5.3.0 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +20 -12
  3. package/dist/Editor/Editor.css +14 -16
  4. package/dist/Editor/Elements/AI/AIInput.js +0 -3
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  6. package/dist/Editor/Elements/Button/EditorButton.js +8 -2
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
  8. package/dist/Editor/Elements/DataView/DataView.js +124 -0
  9. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  10. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
  11. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  12. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  22. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  23. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  24. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  25. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  26. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  27. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  28. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  29. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  30. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  31. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  32. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  33. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  34. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  41. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  42. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  43. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
  44. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
  45. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  46. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
  47. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  48. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
  49. package/dist/Editor/Elements/DataView/styles.js +154 -0
  50. package/dist/Editor/Elements/Form/Form.js +1 -0
  51. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  52. package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
  53. package/dist/Editor/Elements/List/CheckList.js +2 -1
  54. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  55. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  56. package/dist/Editor/Elements/SimpleText/style.js +10 -1
  57. package/dist/Editor/Elements/Table/Table.js +1 -1
  58. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
  59. package/dist/Editor/Styles/EditorStyles.js +5 -0
  60. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
  61. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  62. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  63. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  64. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  65. package/dist/Editor/common/Icon.js +6 -0
  66. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  68. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  69. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  70. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  71. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  72. package/dist/Editor/common/RnD/index.js +1 -1
  73. package/dist/Editor/common/Shorthands/elements.js +13 -1
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  76. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  77. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  78. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  79. package/dist/Editor/common/Uploader.js +8 -0
  80. package/dist/Editor/common/iconListV2.js +53 -53
  81. package/dist/Editor/common/iconslist.js +6 -3
  82. package/dist/Editor/commonStyle.js +9 -0
  83. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  84. package/dist/Editor/helper/index.js +2 -2
  85. package/dist/Editor/helper/theme.js +24 -1
  86. package/dist/Editor/hooks/useMouseMove.js +5 -2
  87. package/dist/Editor/plugins/withEmbeds.js +30 -26
  88. package/dist/Editor/plugins/withHTML.js +47 -12
  89. package/dist/Editor/plugins/withLayout.js +42 -0
  90. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -2
  91. package/dist/Editor/utils/button.js +4 -4
  92. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
  93. package/dist/Editor/utils/dataView.js +43 -0
  94. package/dist/Editor/utils/events.js +0 -1
  95. package/dist/Editor/utils/helper.js +51 -1
  96. package/dist/Editor/utils/pageSettings.js +14 -2
  97. package/dist/Editor/utils/serializeToText.js +2 -0
  98. package/package.json +1 -1
@@ -940,59 +940,6 @@ export function CalendlyIcon() {
940
940
  })]
941
941
  });
942
942
  }
943
- export function DragIcon() {
944
- return /*#__PURE__*/_jsxs("svg", {
945
- width: "16",
946
- height: "12",
947
- viewBox: "0 0 10 6",
948
- fill: "none",
949
- xmlns: "http://www.w3.org/2000/svg",
950
- className: "dragIcon",
951
- children: [/*#__PURE__*/_jsx("ellipse", {
952
- cx: "1.49462",
953
- cy: "4.42384",
954
- rx: "0.779289",
955
- ry: "0.779289",
956
- transform: "rotate(-90 1.49462 4.42384)",
957
- fill: "#94A3B8"
958
- }), /*#__PURE__*/_jsx("ellipse", {
959
- cx: "4.99999",
960
- cy: "4.42384",
961
- rx: "0.779289",
962
- ry: "0.779289",
963
- transform: "rotate(-90 4.99999 4.42384)",
964
- fill: "#94A3B8"
965
- }), /*#__PURE__*/_jsx("ellipse", {
966
- cx: "8.50732",
967
- cy: "4.42384",
968
- rx: "0.779289",
969
- ry: "0.779289",
970
- transform: "rotate(-90 8.50732 4.42384)",
971
- fill: "#94A3B8"
972
- }), /*#__PURE__*/_jsx("ellipse", {
973
- cx: "1.49462",
974
- cy: "0.91993",
975
- rx: "0.779289",
976
- ry: "0.779289",
977
- transform: "rotate(-90 1.49462 0.91993)",
978
- fill: "#94A3B8"
979
- }), /*#__PURE__*/_jsx("ellipse", {
980
- cx: "4.99999",
981
- cy: "0.91993",
982
- rx: "0.779289",
983
- ry: "0.779289",
984
- transform: "rotate(-90 4.99999 0.91993)",
985
- fill: "#94A3B8"
986
- }), /*#__PURE__*/_jsx("ellipse", {
987
- cx: "8.50732",
988
- cy: "0.91993",
989
- rx: "0.779289",
990
- ry: "0.779289",
991
- transform: "rotate(-90 8.50732 0.91993)",
992
- fill: "#94A3B8"
993
- })]
994
- });
995
- }
996
943
  export function LeftAlignTextFormat() {
997
944
  return /*#__PURE__*/_jsxs("svg", {
998
945
  width: "19",
@@ -1245,4 +1192,57 @@ export function CodeElementIcon() {
1245
1192
  strokeLinejoin: "round"
1246
1193
  })]
1247
1194
  });
1195
+ }
1196
+ export function DragIcon() {
1197
+ return /*#__PURE__*/_jsxs("svg", {
1198
+ width: "16",
1199
+ height: "12",
1200
+ viewBox: "0 0 10 6",
1201
+ fill: "none",
1202
+ xmlns: "http://www.w3.org/2000/svg",
1203
+ className: "dragIcon",
1204
+ children: [/*#__PURE__*/_jsx("ellipse", {
1205
+ cx: "1.49462",
1206
+ cy: "4.42384",
1207
+ rx: "0.779289",
1208
+ ry: "0.779289",
1209
+ transform: "rotate(-90 1.49462 4.42384)",
1210
+ fill: "#94A3B8"
1211
+ }), /*#__PURE__*/_jsx("ellipse", {
1212
+ cx: "4.99999",
1213
+ cy: "4.42384",
1214
+ rx: "0.779289",
1215
+ ry: "0.779289",
1216
+ transform: "rotate(-90 4.99999 4.42384)",
1217
+ fill: "#94A3B8"
1218
+ }), /*#__PURE__*/_jsx("ellipse", {
1219
+ cx: "8.50732",
1220
+ cy: "4.42384",
1221
+ rx: "0.779289",
1222
+ ry: "0.779289",
1223
+ transform: "rotate(-90 8.50732 4.42384)",
1224
+ fill: "#94A3B8"
1225
+ }), /*#__PURE__*/_jsx("ellipse", {
1226
+ cx: "1.49462",
1227
+ cy: "0.91993",
1228
+ rx: "0.779289",
1229
+ ry: "0.779289",
1230
+ transform: "rotate(-90 1.49462 0.91993)",
1231
+ fill: "#94A3B8"
1232
+ }), /*#__PURE__*/_jsx("ellipse", {
1233
+ cx: "4.99999",
1234
+ cy: "0.91993",
1235
+ rx: "0.779289",
1236
+ ry: "0.779289",
1237
+ transform: "rotate(-90 4.99999 0.91993)",
1238
+ fill: "#94A3B8"
1239
+ }), /*#__PURE__*/_jsx("ellipse", {
1240
+ cx: "8.50732",
1241
+ cy: "0.91993",
1242
+ rx: "0.779289",
1243
+ ry: "0.779289",
1244
+ transform: "rotate(-90 8.50732 0.91993)",
1245
+ fill: "#94A3B8"
1246
+ })]
1247
+ });
1248
1248
  }
@@ -1346,19 +1346,22 @@ export const GridAddSectionIcon = props => /*#__PURE__*/_jsxs("svg", {
1346
1346
  stroke: "#64748B",
1347
1347
  strokeWidth: "1.5",
1348
1348
  strokeLinecap: "round",
1349
- strokeLinejoin: "round"
1349
+ strokeLinejoin: "round",
1350
+ className: "fillStroke"
1350
1351
  }), /*#__PURE__*/_jsx("path", {
1351
1352
  d: "M10.1733 6.125V14.875",
1352
1353
  stroke: "#64748B",
1353
1354
  strokeWidth: "1.5",
1354
1355
  strokeLinecap: "round",
1355
- strokeLinejoin: "round"
1356
+ strokeLinejoin: "round",
1357
+ className: "fillStroke"
1356
1358
  }), /*#__PURE__*/_jsx("path", {
1357
1359
  d: "M5.79834 10.5H14.5483",
1358
1360
  stroke: "#64748B",
1359
1361
  strokeWidth: "1.5",
1360
1362
  strokeLinecap: "round",
1361
- strokeLinejoin: "round"
1363
+ strokeLinejoin: "round",
1364
+ className: "fillStroke"
1362
1365
  })]
1363
1366
  });
1364
1367
  export const FormIcon = () => {
@@ -252,6 +252,15 @@ const useCommonStyle = theme => ({
252
252
  border: `1px solid transparent !important`
253
253
  }
254
254
  }
255
+ },
256
+ buttonMoreOption: {
257
+ background: `${theme?.palette?.editor?.aiInputBackground} !important`,
258
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
259
+ '& svg': {
260
+ '& path': {
261
+ stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
262
+ }
263
+ }
255
264
  }
256
265
  });
257
266
  export default useCommonStyle;
@@ -0,0 +1,41 @@
1
+ function enforceDateFormat(inputElement) {
2
+ inputElement.addEventListener("input", event => {
3
+ const input = event.target;
4
+ let value = input.value;
5
+
6
+ // Allow only numbers and forward slashes
7
+ value = value.replace(/[^\d/]/g, "");
8
+
9
+ // Enforce MM/DD/YYYY structure
10
+ if (value.length > 10) {
11
+ value = value.slice(0, 10);
12
+ }
13
+ const parts = value.split("/");
14
+ if (parts.length > 1) {
15
+ parts[0] = parts[0].slice(0, 2); // Limit MM to 2 digits
16
+ if (parts[0] > 12) parts[0] = "12"; // Max month value
17
+ }
18
+
19
+ if (parts.length > 2) {
20
+ parts[1] = parts[1].slice(0, 2); // Limit DD to 2 digits
21
+ if (parts[1] > 31) parts[1] = "31"; // Max day value
22
+ }
23
+
24
+ if (parts.length > 3) {
25
+ parts[2] = parts[2].slice(0, 4); // Limit YYYY to 4 digits
26
+ }
27
+
28
+ input.value = parts.join("/");
29
+
30
+ // Optionally, validate the full date
31
+ if (input.value.length === 10) {
32
+ const [month, day, year] = input.value.split("/").map(Number);
33
+ const isValidDate = !isNaN(Date.parse(`${year}-${month}-${day}`));
34
+ if (!isValidDate) {
35
+ input.value = ""; // Clear input if invalid
36
+ alert("Invalid date format. Please enter a valid MM/DD/YYYY date.");
37
+ }
38
+ }
39
+ });
40
+ }
41
+ export default enforceDateFormat;
@@ -331,14 +331,14 @@ export const isCarouselSelected = editor => {
331
331
  return false;
332
332
  }
333
333
  const [nodeEntry] = Editor.nodes(editor, {
334
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
334
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
335
335
  });
336
336
  if (!nodeEntry) {
337
337
  return false;
338
338
  }
339
339
  const [node] = nodeEntry;
340
340
  const carouselDom = ReactEditor.toDOMNode(editor, node);
341
- const isEdit = carouselDom.classList.contains('carousel_slider_edit');
341
+ const isEdit = carouselDom.classList.contains("carousel_slider_edit");
342
342
  return !isEdit;
343
343
  } catch (err) {
344
344
  console.log(err);
@@ -147,4 +147,27 @@ export const groupByBreakpoint = (styleProps, theme) => {
147
147
  }
148
148
  };
149
149
  };
150
- export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
150
+ export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
151
+ export const getBreakpointLineSpacing = (value, breakpoint) => {
152
+ try {
153
+ const values = getBreakPointsValue(value, breakpoint);
154
+ const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
155
+ if (values[b] || values["lg"]) {
156
+ const value = values[b] || values["lg"];
157
+ return {
158
+ ...a,
159
+ [b]: value
160
+ };
161
+ } else {
162
+ return a;
163
+ }
164
+ }, {});
165
+ if (breakpoint) {
166
+ return value[breakpoint] || value["lg"] || value;
167
+ } else {
168
+ return cssVal["lg"];
169
+ }
170
+ } catch (err) {
171
+ // console.log(err);
172
+ }
173
+ };
@@ -35,6 +35,7 @@ export const EditorProvider = ({
35
35
  path: null
36
36
  });
37
37
  const [fontFamilies, setFontFamilies] = useState({});
38
+ const [activeBreakPoint, setActiveBreakPoint] = useState("");
38
39
  useEffect(() => {
39
40
  window.updateSelectedItem = d => {
40
41
  setSelectedElement(d);
@@ -97,8 +98,10 @@ export const EditorProvider = ({
97
98
  setOpenAI,
98
99
  updateDragging,
99
100
  fontFamilies,
100
- setFontFamilies
101
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
101
+ setFontFamilies,
102
+ activeBreakPoint,
103
+ setActiveBreakPoint
104
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
102
105
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
103
106
  value: otherValues,
104
107
  children: children
@@ -40,32 +40,36 @@ const withEmbeds = editor => {
40
40
  }
41
41
  };
42
42
  editor.insertBreak = (...args) => {
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);
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);
69
73
  }
70
74
  };
71
75
  return editor;
@@ -2,6 +2,8 @@ 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"];
5
7
  const loopChildren = (children = [], defaultInsert) => {
6
8
  if (!children?.length) {
7
9
  return defaultInsert;
@@ -61,13 +63,18 @@ const insertAtNextNode = (editor, formattedFragment) => {
61
63
  console.log(err);
62
64
  }
63
65
  };
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
- }
70
- };
66
+
67
+ // const handleInsert = (editor, defaultInsert, fragment = []) => {
68
+ // if (
69
+ // getCurrentElementText(editor) &&
70
+ // fragment.some((f) => f.type === "table")
71
+ // ) {
72
+ // insertAtNextNode(editor, fragment);
73
+ // } else {
74
+ // defaultInsert();
75
+ // }
76
+ // };
77
+
71
78
  const getTableCellChild = (fragment = []) => {
72
79
  const table = fragment.find(node => node.type === "table");
73
80
  const row = table?.children?.find(node => node.type === "table-row");
@@ -120,7 +127,10 @@ const withHtml = editor => {
120
127
  const slateHTML = data?.getData("application/x-slate-fragment");
121
128
  const html = data?.getData("text/html");
122
129
  const currentEl = getCurrentElement(editor);
123
- let eltype = currentEl?.type;
130
+ const eltype = currentEl?.type;
131
+ const firstNode = editor?.children?.[0];
132
+ const titlePath = firstNode?.type === "topbanner" ? 1 : 0;
133
+ const isTitlePath = editor.needLayout && editor?.selection?.anchor?.path[0] === titlePath;
124
134
  if (slateHTML && !formatFragment[eltype]) {
125
135
  const [tableCellNode] = Editor.nodes(editor, {
126
136
  match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
@@ -170,22 +180,38 @@ const withHtml = editor => {
170
180
  Transforms.insertText(editor, text);
171
181
  }
172
182
  } else {
173
- handleInsert(editor, () => insertData(data), decoded);
183
+ const isTextNode = ALLOWED_TEXT_NODES.includes(decoded?.[0]?.type);
184
+ if (isTitlePath && !isTextNode) {
185
+ insertAtNextNode(editor, decoded);
186
+ return;
187
+ }
188
+ const currentText = getCurrentElementText(editor);
189
+ if (currentText && !isTextNode) {
190
+ insertAtNextNode(editor, decoded);
191
+ return;
192
+ }
193
+ insertData(data);
174
194
  }
175
195
  } else if (html) {
176
196
  const parsed = new DOMParser().parseFromString(html, "text/html");
197
+ const rootElement = parsed.body || parsed.documentElement;
198
+ const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
177
199
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
178
200
  if (isGoogleSheet) {
179
201
  if (editor.isChatEditor) {
180
202
  return;
181
203
  }
182
- const table = parsed.body.querySelector("table");
204
+ const table = rootElement.querySelector("table");
183
205
  const colGrp = table.querySelector("colgroup");
184
206
  if (colGrp) {
185
207
  colGrp.remove();
186
208
  }
187
209
  const fragment = deserialize(table);
188
- Transforms.insertFragment(editor, [fragment]);
210
+ if (isTitlePath) {
211
+ insertAtNextNode(editor, [fragment]);
212
+ } else {
213
+ Transforms.insertFragment(editor, [fragment]);
214
+ }
189
215
  return;
190
216
  }
191
217
  const fragment = deserialize(parsed.body);
@@ -199,7 +225,16 @@ const withHtml = editor => {
199
225
  if (editor.isChatEditor && is_img_table) {
200
226
  return;
201
227
  }
202
- handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
228
+ if (isTitlePath && isNonText) {
229
+ insertAtNextNode(editor, formattedFragment);
230
+ return;
231
+ }
232
+ const currentText = getCurrentElementText(editor);
233
+ if (currentText && isNonText) {
234
+ insertAtNextNode(editor, formattedFragment);
235
+ return;
236
+ }
237
+ Transforms.insertFragment(editor, formattedFragment);
203
238
  return;
204
239
  } else {
205
240
  insertData(data);
@@ -58,7 +58,49 @@ const withLayout = editor => {
58
58
  Transforms.insertNodes(editor, paragraph, {
59
59
  at: path.concat(1)
60
60
  });
61
+ return;
61
62
  }
63
+
64
+ // Transforms.insertNodes(editor, paragraph, { at: [0] });
65
+ // const extractFirstText = (node) => {
66
+ // if (node.text) {
67
+ // return node.text;
68
+ // }
69
+ // if (node.children) {
70
+ // for (const child of node.children) {
71
+ // const text = extractFirstText(child);
72
+ // if (text) {
73
+ // return text;
74
+ // }
75
+ // }
76
+ // }
77
+ // return "";
78
+ // };
79
+
80
+ // const extractRemainingNodes = (node) => {
81
+ // if (!node.children) {
82
+ // return [];
83
+ // }
84
+ // const [, ...remainingChildren] = node.children;
85
+ // return remainingChildren.map((child) => ({ ...child }));
86
+ // };
87
+
88
+ // const firstNode = editor.children[0];
89
+ // const firstContent = extractFirstText(firstNode);
90
+
91
+ // if (firstNode.type !== "title") {
92
+ // const titleNode = {
93
+ // type: "title",
94
+ // children: [{ text: firstContent }],
95
+ // };
96
+ // Transforms.removeNodes(editor, { at: [0] });
97
+ // Transforms.insertNodes(editor, titleNode, { at: [0], select: true });
98
+ // const remainingNodes = extractRemainingNodes(firstNode);
99
+ // if (remainingNodes.length > 0) {
100
+ // Transforms.insertNodes(editor, remainingNodes, { at: [1] });
101
+ // }
102
+ // }
103
+
62
104
  ORDERS_LAYOUT.forEach((enforce, index) => {
63
105
  if (index < editor.children.length) {
64
106
  const existsNode = Node.get(editor, [index]);
@@ -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
  };
@@ -309,7 +312,8 @@ export const getBlock = props => {
309
312
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
310
313
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
311
314
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
312
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
315
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
316
+ lineHeight: 1.43
313
317
  },
314
318
  children: children
315
319
  });
@@ -369,6 +373,9 @@ export const getBlock = props => {
369
373
  });
370
374
  case "orderedList":
371
375
  return /*#__PURE__*/_jsx("ol", {
376
+ style: {
377
+ lineHeight: 1.43
378
+ },
372
379
  className: "listItemMargin",
373
380
  type: "1",
374
381
  ...attributes,
@@ -376,6 +383,9 @@ export const getBlock = props => {
376
383
  });
377
384
  case "unorderedList":
378
385
  return /*#__PURE__*/_jsx("ul", {
386
+ style: {
387
+ lineHeight: 1.43
388
+ },
379
389
  className: "listItemMargin",
380
390
  ...attributes,
381
391
  children: children
@@ -564,6 +574,19 @@ export const getBlock = props => {
564
574
  contentEditable: false,
565
575
  children: children
566
576
  });
577
+ // Data View
578
+ case "dataView":
579
+ return /*#__PURE__*/_jsx(DataView, {
580
+ ...props
581
+ });
582
+ case "viewData":
583
+ return /*#__PURE__*/_jsx(ViewData, {
584
+ ...props
585
+ });
586
+ case "columnView":
587
+ return /*#__PURE__*/_jsx(ColumnView, {
588
+ ...props
589
+ });
567
590
  default:
568
591
  return /*#__PURE__*/_jsx(SimpleText, {
569
592
  ...props,
@@ -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);
@@ -245,6 +260,13 @@ export const getBlock = props => {
245
260
  ,
246
261
  children: children
247
262
  });
263
+ case "title":
264
+ return /*#__PURE__*/_jsx("h3", {
265
+ ...attributes,
266
+ ...element.attr,
267
+ className: `content-editable ${isEmpty ? "empty" : ""}`,
268
+ children: children
269
+ });
248
270
  case "headingThree":
249
271
  return /*#__PURE__*/_jsx("h3", {
250
272
  ...attributes,
@@ -342,6 +364,9 @@ export const getBlock = props => {
342
364
  ...props
343
365
  });
344
366
  default:
345
- return null;
367
+ return /*#__PURE__*/_jsx(SimpleText, {
368
+ ...props,
369
+ isEmpty: isEmpty
370
+ });
346
371
  }
347
372
  };
@@ -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
+ };