@flozy/editor 5.5.1 → 5.5.3

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 (37) hide show
  1. package/dist/Editor/CommonEditor.js +11 -4
  2. package/dist/Editor/Editor.css +17 -15
  3. package/dist/Editor/Elements/Button/EditorButton.js +3 -1
  4. package/dist/Editor/Elements/Form/Form.js +1 -0
  5. package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
  6. package/dist/Editor/Elements/List/CheckList.js +2 -1
  7. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  8. package/dist/Editor/Elements/SimpleText/index.js +11 -3
  9. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  10. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -2
  11. package/dist/Editor/Toolbar/Mini/Styles.js +5 -0
  12. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
  13. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  14. package/dist/Editor/common/FontLoader/FontList.js +3 -0
  15. package/dist/Editor/common/FontLoader/FontLoader.js +9 -6
  16. package/dist/Editor/common/MentionsPopup/Styles.js +1 -0
  17. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  18. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  19. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  20. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  21. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  22. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  23. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  24. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  25. package/dist/Editor/common/Uploader.js +8 -0
  26. package/dist/Editor/commonStyle.js +4 -4
  27. package/dist/Editor/helper/deserialize/index.js +66 -24
  28. package/dist/Editor/helper/index.js +2 -2
  29. package/dist/Editor/helper/theme.js +24 -1
  30. package/dist/Editor/hooks/useMouseMove.js +5 -2
  31. package/dist/Editor/plugins/withHTML.js +42 -5
  32. package/dist/Editor/utils/SlateUtilityFunctions.js +8 -1
  33. package/dist/Editor/utils/button.js +4 -4
  34. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +51 -7
  35. package/dist/Editor/utils/helper.js +19 -16
  36. package/dist/Editor/utils/pageSettings.js +14 -2
  37. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ import React, { useState } from "react";
2
+ import { Grid, Slider, Typography, Box } from "@mui/material";
3
+ import { getBreakPointsValue } from "../../../helper/theme";
4
+ import useWindowResize from "../../../hooks/useWindowResize";
5
+ import { useEditorContext } from "../../../hooks/useMouseMove";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const LineSpacing = props => {
9
+ const {
10
+ value: val,
11
+ data,
12
+ onChange
13
+ } = props;
14
+ const {
15
+ theme
16
+ } = useEditorContext();
17
+ const {
18
+ key
19
+ } = data;
20
+ const [size] = useWindowResize();
21
+ const pro_value = getBreakPointsValue(val, size?.device);
22
+ const [value, setValue] = useState(pro_value);
23
+ let breakpointValue = getBreakPointsValue(val, null);
24
+ breakpointValue = typeof breakpointValue['lg'] === 'object' ? breakpointValue['lg'] : breakpointValue;
25
+ useState(() => {
26
+ setValue(pro_value);
27
+ }, [pro_value]);
28
+ const handleChange = e => {
29
+ onChange({
30
+ [key]: {
31
+ ...breakpointValue,
32
+ [size?.device]: e.target.value
33
+ }
34
+ });
35
+ };
36
+ return /*#__PURE__*/_jsxs(Grid, {
37
+ item: true,
38
+ xs: 12,
39
+ children: [/*#__PURE__*/_jsx(Typography, {
40
+ variant: "body1",
41
+ color: "primary",
42
+ style: {
43
+ fontSize: "14px",
44
+ fontWeight: 500
45
+ },
46
+ children: data?.label
47
+ }), /*#__PURE__*/_jsxs(Grid, {
48
+ container: true,
49
+ wrap: "nowrap",
50
+ className: "sld-wrpr",
51
+ children: [/*#__PURE__*/_jsx(Slider, {
52
+ className: "spacingSlider",
53
+ defaultValue: value || 1.43,
54
+ "aria-label": "Default",
55
+ valueLabelDisplay: "auto",
56
+ min: 0.5,
57
+ max: 3.0,
58
+ step: 0.1,
59
+ name: "lineHeight",
60
+ onChange: handleChange
61
+ }), /*#__PURE__*/_jsx(Box, {
62
+ component: "input",
63
+ sx: {
64
+ background: theme?.palette?.editor?.background,
65
+ color: theme?.palette?.editor?.textColor
66
+ },
67
+ name: "lineHeight",
68
+ value: pro_value,
69
+ className: "sliderInput",
70
+ onChange: handleChange,
71
+ type: "number",
72
+ placeholder: "0",
73
+ disabled: true,
74
+ defaultValue: pro_value || 1.43
75
+ })]
76
+ })]
77
+ });
78
+ };
79
+ export default LineSpacing;
@@ -25,6 +25,10 @@ const pageSettingsStyle = [{
25
25
  label: "Padding",
26
26
  key: "bannerSpacing",
27
27
  type: "bannerSpacing"
28
+ }, {
29
+ label: "Line Spacing",
30
+ key: "lineHeight",
31
+ type: "lineSpacing"
28
32
  }]
29
33
  }, {
30
34
  tab: "Max Width",
@@ -4,6 +4,7 @@ import { convertBase64 } from "../utils/helper";
4
4
  import { uploadFile } from "../service/fileupload";
5
5
  import Icon from "./Icon";
6
6
  import UploadStyles from "../common/ImageSelector/UploadStyles";
7
+ import { useEditorContext } from "../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,6 +19,9 @@ const Uploader = props => {
18
19
  const [base64, setBase64] = useState(value?.url);
19
20
  const [fileName, setFileName] = useState("");
20
21
  const [uploading, setUploading] = useState(false);
22
+ const {
23
+ theme
24
+ } = useEditorContext();
21
25
  const handleChange = async e => {
22
26
  const uFile = e.target.files[0];
23
27
  const strImage = await convertBase64(uFile);
@@ -99,6 +103,10 @@ const Uploader = props => {
99
103
  className: "uploadImageSection",
100
104
  children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
101
105
  className: "uploadImageText",
106
+ sx: {
107
+ background: `${theme?.palette?.editor?.inputFieldBgColor}`,
108
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
109
+ },
102
110
  children: /*#__PURE__*/_jsxs(Button, {
103
111
  component: "label",
104
112
  variant: "text",
@@ -464,10 +464,6 @@ const useCommonStyle = theme => ({
464
464
  }
465
465
  }
466
466
  },
467
- pageSettingPopUpRoot: {
468
- padding: "16px 8px 16px 10px!important",
469
- height: "100%"
470
- },
471
467
  buttonMoreOption: {
472
468
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
473
469
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -480,6 +476,10 @@ const useCommonStyle = theme => ({
480
476
  }
481
477
  }
482
478
  },
479
+ pageSettingPopUpRoot: {
480
+ padding: "16px 8px 16px 10px!important",
481
+ height: "100%"
482
+ },
483
483
  buttonMoreOption2: {
484
484
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
485
485
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -1,4 +1,26 @@
1
1
  import { jsx } from "slate-hyperscript";
2
+ const inlineStyles = [{
3
+ key: "bold",
4
+ getStyle: styles => styles.fontWeight === "bold" || parseInt(styles.fontWeight, 10) >= 700
5
+ }, {
6
+ key: "italic",
7
+ getStyle: styles => styles.fontStyle === "italic"
8
+ }, {
9
+ key: "underline",
10
+ getStyle: styles => styles.textDecoration.includes("underline")
11
+ }];
12
+ function getInlineTextStyles(element) {
13
+ if (!element || !element.style) return {};
14
+ const styles = element.style;
15
+ const elementStyles = inlineStyles.reduce((total, currVal) => {
16
+ const style = currVal.getStyle(styles);
17
+ if (style) {
18
+ total[currVal.key] = style;
19
+ }
20
+ return total;
21
+ }, {});
22
+ return elementStyles;
23
+ }
2
24
  const handleTableCell = (el, children) => {
3
25
  const wrapChild = children?.map(c => {
4
26
  if (typeof c === "string") {
@@ -20,6 +42,24 @@ const handleTableCell = (el, children) => {
20
42
  }
21
43
  };
22
44
  };
45
+ const INLINE_TAGS = ["A", "ABBR", "B", "BDO", "CITE", "CODE", "DATA", "DEL", "DFN", "IMG", "INS", "KBD", "LABEL", "MARK", "Q", "SAMP", "SMALL", "SPAN", "SUB", "SUP", "TIME", "VAR"];
46
+
47
+ // to avoid nested paragraph to resolve performace issue
48
+ const paragraphType = el => {
49
+ const {
50
+ childNodes = []
51
+ } = el || {};
52
+
53
+ // if anyone of the child node is text node or wrapped with inline tags, it is considered to be an paragraph node
54
+ const isHavingText = childNodes?.length ? Array.from(childNodes)?.some(child => {
55
+ const isTextNode = child?.nodeType === 3;
56
+ const isHavingInlineTags = TEXT_TAGS[child?.nodeName] || INLINE_TAGS.includes(child.nodeName);
57
+ return isTextNode || isHavingInlineTags;
58
+ }) : null;
59
+ return isHavingText ? {
60
+ type: "paragraph"
61
+ } : {};
62
+ };
23
63
  const ELEMENT_TAGS = {
24
64
  A: el => ({
25
65
  type: "link",
@@ -59,24 +99,14 @@ const ELEMENT_TAGS = {
59
99
  OL: () => ({
60
100
  type: "orderedList"
61
101
  }),
62
- P: () => ({
63
- type: "paragraph"
64
- }),
65
- DIV: () => ({
66
- type: "paragraph"
67
- }),
102
+ P: paragraphType,
103
+ DIV: paragraphType,
68
104
  PRE: () => ({
69
105
  type: "code"
70
106
  }),
71
- META: () => ({
72
- type: "paragraph"
73
- }),
74
- STYLE: () => ({
75
- type: "paragraph"
76
- }),
77
- "GOOGLE-SHEETS-HTML-ORIGIN": () => ({
78
- type: "paragraph"
79
- }),
107
+ META: paragraphType,
108
+ STYLE: paragraphType,
109
+ "GOOGLE-SHEETS-HTML-ORIGIN": paragraphType,
80
110
  TABLE: (el, children = []) => {
81
111
  try {
82
112
  const bodyChild = children || [];
@@ -98,12 +128,8 @@ const ELEMENT_TAGS = {
98
128
  type: "table-row"
99
129
  }),
100
130
  TD: handleTableCell,
101
- COLGROUP: () => ({
102
- type: "paragraph"
103
- }),
104
- COL: () => ({
105
- type: "paragraph"
106
- })
131
+ COLGROUP: paragraphType,
132
+ COL: paragraphType
107
133
  };
108
134
 
109
135
  // COMPAT: `B` is omitted here because Google Docs uses `<b>` in weird ways.
@@ -129,11 +155,18 @@ const TEXT_TAGS = {
129
155
  U: () => ({
130
156
  underline: true
131
157
  })
158
+ // B: () => ({ bold: true }),
132
159
  };
160
+
133
161
  const deserialize = el => {
134
162
  if (el.nodeType === 3) {
163
+ // if there is any line-breaks
135
164
  const match = /\r|\n/.exec(el.textContent);
136
- return match ? null : el.textContent;
165
+ const text = el.textContent.replace(/\r|\n/g, "").trim();
166
+ return match && !text ? null : {
167
+ text,
168
+ ...getInlineTextStyles(el.parentNode)
169
+ };
137
170
  } else if (el.nodeType !== 1) {
138
171
  return null;
139
172
  } else if (el.nodeName === "BR") {
@@ -160,11 +193,20 @@ const deserialize = el => {
160
193
  overwriteChild,
161
194
  ...attrs
162
195
  } = ELEMENT_TAGS[nodeName](el, children);
163
- return jsx("element", attrs, overwriteChild || children);
196
+ if (attrs?.type) {
197
+ return jsx("element", attrs, overwriteChild || children);
198
+ }
164
199
  }
165
200
  if (TEXT_TAGS[nodeName]) {
166
201
  const attrs = TEXT_TAGS[nodeName](el);
167
- return children.map(child => jsx("text", attrs, child));
202
+ return children.map(child => {
203
+ if (child?.type) {
204
+ // if any list elements (like ul, ol... tags) is wrapped inside the TEXT_TAGS, we will return child as it is, else return it as text node
205
+ return child;
206
+ } else {
207
+ return jsx("text", attrs, child);
208
+ }
209
+ });
168
210
  }
169
211
  return children;
170
212
  };
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
337
337
  return false;
338
338
  }
339
339
  const [nodeEntry] = Editor.nodes(editor, {
340
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
340
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
341
341
  });
342
342
  if (!nodeEntry) {
343
343
  return false;
344
344
  }
345
345
  const [node] = nodeEntry;
346
346
  const carouselDom = ReactEditor.toDOMNode(editor, node);
347
- const isEdit = carouselDom.classList.contains('carousel_slider_edit');
347
+ const isEdit = carouselDom.classList.contains("carousel_slider_edit");
348
348
  return !isEdit;
349
349
  } catch (err) {
350
350
  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
@@ -4,6 +4,43 @@ import { decodeAndParseBase64 } from "../utils/helper";
4
4
  const avoidDefaultInsert = ["table", "grid"];
5
5
  const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
6
6
  const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
7
+ const parseCopiedHTML = html => {
8
+ const parsed = new DOMParser().parseFromString(html, "text/html");
9
+
10
+ // if ol, ul are inside li, remove and push ol,ul after that li to maintain format between our slate list and external source list's json
11
+ parsed.querySelectorAll("li > ul, li > ol").forEach(list => {
12
+ // Find the parent li
13
+ const parentLi = list.parentElement;
14
+
15
+ // Move the list after the parent li
16
+ parentLi.after(list);
17
+ });
18
+
19
+ // to handle google docs list
20
+ parsed.querySelectorAll("li p, li div").forEach(element => {
21
+ const parent = element.parentNode;
22
+ // Move all child nodes of <p> or <div> to its parent <li>
23
+ while (element.firstChild) {
24
+ parent.insertBefore(element.firstChild, element);
25
+ }
26
+ // Remove the <p> or <div> element
27
+ parent.removeChild(element);
28
+ });
29
+
30
+ // claude.ai, copy list inbetween, some li tags are not wrapped with ul or ol
31
+ parsed.querySelectorAll("li").forEach(li => {
32
+ // Check if the parent of <li> is not a <ul> or <ol>
33
+ if (!li.parentElement || li.parentElement.tagName !== "UL" && li.parentElement.tagName !== "OL") {
34
+ // Create a <ul> element
35
+ const ul = document.createElement("ul");
36
+ // Append the <li> to the <ul>
37
+ ul.appendChild(li.cloneNode(true)); // Clone the <li>
38
+ // Replace the original <li> in the DOM with the <ul>
39
+ li.replaceWith(ul);
40
+ }
41
+ });
42
+ return parsed;
43
+ };
7
44
  const loopChildren = (children = [], defaultInsert) => {
8
45
  if (!children?.length) {
9
46
  return defaultInsert;
@@ -28,7 +65,7 @@ const getCurrentElement = editor => {
28
65
  return null;
29
66
  }
30
67
  };
31
- const getCurrentElementText = editor => {
68
+ export const getCurrentElementText = editor => {
32
69
  try {
33
70
  if (editor.selection) {
34
71
  return Editor.string(editor, editor?.selection?.anchor?.path);
@@ -186,15 +223,15 @@ const withHtml = editor => {
186
223
  return;
187
224
  }
188
225
  const currentText = getCurrentElementText(editor);
189
- if (currentText && !isTextNode) {
226
+ if (currentText?.trim() && !isTextNode) {
190
227
  insertAtNextNode(editor, decoded);
191
228
  return;
192
229
  }
193
230
  insertData(data);
194
231
  }
195
232
  } else if (html) {
196
- const parsed = new DOMParser().parseFromString(html, "text/html");
197
- const rootElement = parsed.body || parsed.documentElement;
233
+ const parsed = parseCopiedHTML(html);
234
+ const rootElement = parsed.body;
198
235
  const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
199
236
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
200
237
  if (isGoogleSheet) {
@@ -230,7 +267,7 @@ const withHtml = editor => {
230
267
  return;
231
268
  }
232
269
  const currentText = getCurrentElementText(editor);
233
- if (currentText && isNonText) {
270
+ if (currentText?.trim() && isNonText) {
234
271
  insertAtNextNode(editor, formattedFragment);
235
272
  return;
236
273
  }
@@ -314,7 +314,8 @@ export const getBlock = props => {
314
314
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
315
315
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
316
316
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
317
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
317
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
318
+ lineHeight: 1.43
318
319
  },
319
320
  children: children
320
321
  });
@@ -374,6 +375,9 @@ export const getBlock = props => {
374
375
  });
375
376
  case "orderedList":
376
377
  return /*#__PURE__*/_jsx("ol", {
378
+ style: {
379
+ lineHeight: 1.43
380
+ },
377
381
  className: "listItemMargin",
378
382
  type: "1",
379
383
  ...attributes,
@@ -381,6 +385,9 @@ export const getBlock = props => {
381
385
  });
382
386
  case "unorderedList":
383
387
  return /*#__PURE__*/_jsx("ul", {
388
+ style: {
389
+ lineHeight: 1.43
390
+ },
384
391
  className: "listItemMargin",
385
392
  ...attributes,
386
393
  children: children
@@ -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
  };
@@ -237,24 +237,30 @@ export const getBlock = props => {
237
237
  return /*#__PURE__*/_jsx("p", {
238
238
  ...attributes,
239
239
  ...element.attr,
240
- className: `content-editable ${isEmpty ? "empty" : ""}`
240
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`
241
241
  // placeholder="paragraph"
242
242
  ,
243
243
  children: children
244
244
  });
245
245
  case "headingOne":
246
- return /*#__PURE__*/_jsx("h1", {
246
+ return /*#__PURE__*/_jsx("h3", {
247
247
  ...attributes,
248
248
  ...element.attr,
249
+ style: {
250
+ margin: "10px 0px"
251
+ },
249
252
  className: `content-editable ${isEmpty ? "empty" : ""}`
250
253
  // placeholder="Heading 1"
251
254
  ,
252
255
  children: children
253
256
  });
254
257
  case "headingTwo":
255
- return /*#__PURE__*/_jsx("h2", {
258
+ return /*#__PURE__*/_jsx("h3", {
256
259
  ...attributes,
257
260
  ...element.attr,
261
+ style: {
262
+ margin: "10px 0px"
263
+ },
258
264
  className: `content-editable ${isEmpty ? "empty" : ""}`
259
265
  // placeholder="Heading 2"
260
266
  ,
@@ -264,18 +270,55 @@ export const getBlock = props => {
264
270
  return /*#__PURE__*/_jsx("h3", {
265
271
  ...attributes,
266
272
  ...element.attr,
267
- className: `content-editable ${isEmpty ? "empty" : ""}`,
273
+ style: {
274
+ margin: "10px 0px"
275
+ },
276
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
268
277
  children: children
269
278
  });
270
279
  case "headingThree":
271
280
  return /*#__PURE__*/_jsx("h3", {
272
281
  ...attributes,
273
282
  ...element.attr,
283
+ style: {
284
+ margin: "10px 0px"
285
+ },
274
286
  className: `content-editable ${isEmpty ? "empty" : ""}`
275
287
  // placeholder="Heading 3"
276
288
  ,
277
289
  children: children
278
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
+ });
279
322
  case "blockquote":
280
323
  return /*#__PURE__*/_jsx("blockquote", {
281
324
  ...attributes,
@@ -327,7 +370,7 @@ export const getBlock = props => {
327
370
  return /*#__PURE__*/_jsx("li", {
328
371
  ...attributes,
329
372
  ...element.attr,
330
- className: `content-editable ${isEmpty ? "empty" : ""}`,
373
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
331
374
  placeholder: "List",
332
375
  style: {
333
376
  color: firstChildren?.color
@@ -344,7 +387,7 @@ export const getBlock = props => {
344
387
  return /*#__PURE__*/_jsx("p", {
345
388
  ...attributes,
346
389
  ...element.attr,
347
- className: `content-editable ${isEmpty ? "empty" : ""}`
390
+ className: `content-editable ${isEmpty ? "empty" : ""} m-0`
348
391
  // placeholder="paragraph"
349
392
  ,
350
393
  children: children
@@ -366,7 +409,8 @@ export const getBlock = props => {
366
409
  default:
367
410
  return /*#__PURE__*/_jsx(SimpleText, {
368
411
  ...props,
369
- isEmpty: isEmpty
412
+ isEmpty: isEmpty,
413
+ isChatEditor: true
370
414
  });
371
415
  }
372
416
  };
@@ -624,6 +624,10 @@ export const isPageSettings = (event, editor) => {
624
624
  return isPageSettingsNode;
625
625
  }
626
626
  };
627
+ export function capitalizeFirstLetter(str) {
628
+ if (!str) return str;
629
+ return str.charAt(0).toUpperCase() + str.slice(1);
630
+ }
627
631
  export const insertLineBreakAtEndOfPath = (editor, path) => {
628
632
  try {
629
633
  const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
@@ -642,6 +646,13 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
642
646
  console.log(err);
643
647
  }
644
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
+ }
645
656
  const omitNodes = ["site-settings", "page-settings"];
646
657
  export function getInitialValue(value = [], readOnly) {
647
658
  if (readOnly === "readonly" && value?.length) {
@@ -670,20 +681,17 @@ export function getInitialValue(value = [], readOnly) {
670
681
  }
671
682
  return value;
672
683
  }
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
684
  export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
685
685
  return `${defaultCls} ${selected ? selectedClsName : ""}`;
686
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
+ };
687
695
  export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
688
696
  try {
689
697
  const options = {
@@ -697,11 +705,6 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
697
705
  return [];
698
706
  }
699
707
  };
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
708
  export const getSlateDom = (editor, range) => {
706
709
  try {
707
710
  const slateDom = ReactEditor.toDOMRange(editor, range);