@flozy/editor 5.9.8 → 6.0.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 (108) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +21 -79
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +15 -29
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  6. package/dist/Editor/Elements/Button/EditorButton.js +9 -25
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +12 -57
  8. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  10. package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
  11. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
  12. package/dist/Editor/Elements/Embed/Image.js +2 -2
  13. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +14 -0
  14. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  15. package/dist/Editor/Elements/Grid/GridItem.js +3 -2
  16. package/dist/Editor/Elements/Link/Link.js +43 -70
  17. package/dist/Editor/Elements/SimpleText/index.js +12 -7
  18. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  19. package/dist/Editor/Elements/Title/title.js +1 -13
  20. package/dist/Editor/Elements/Variables/Style.js +2 -28
  21. package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
  22. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  23. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  24. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  25. package/dist/Editor/Toolbar/FormatTools/TextSize.js +15 -7
  26. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +8 -9
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +90 -210
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  30. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -16
  31. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +9 -56
  32. package/dist/Editor/Toolbar/PopupTool/index.js +37 -29
  33. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  34. package/dist/Editor/common/ColorPickerButton.js +9 -32
  35. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  36. package/dist/Editor/common/DnD/Draggable.js +1 -0
  37. package/dist/Editor/common/FontLoader/FontList.js +11 -3
  38. package/dist/Editor/common/FontLoader/FontLoader.js +42 -74
  39. package/dist/Editor/common/Icon.js +0 -28
  40. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  41. package/dist/Editor/common/MentionsPopup/Styles.js +9 -3
  42. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  43. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  44. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  45. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  46. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  47. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  48. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  49. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  50. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  51. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -8
  52. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  53. package/dist/Editor/common/RnD/Utils/gridDropItem.js +4 -5
  54. package/dist/Editor/common/RnD/Utils/index.js +0 -40
  55. package/dist/Editor/common/RnD/index.js +3 -23
  56. package/dist/Editor/common/Section/index.js +89 -60
  57. package/dist/Editor/common/Shorthands/elements.js +0 -54
  58. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  59. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  60. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  61. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  62. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  63. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +11 -35
  64. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  66. package/dist/Editor/common/Uploader.js +0 -8
  67. package/dist/Editor/commonStyle.js +65 -55
  68. package/dist/Editor/helper/index.js +2 -2
  69. package/dist/Editor/helper/theme.js +2 -200
  70. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  71. package/dist/Editor/hooks/useMouseMove.js +3 -9
  72. package/dist/Editor/plugins/withEmbeds.js +1 -1
  73. package/dist/Editor/plugins/withHTML.js +1 -1
  74. package/dist/Editor/plugins/withLayout.js +1 -1
  75. package/dist/Editor/plugins/withTable.js +1 -1
  76. package/dist/Editor/theme/ThemeList.js +173 -50
  77. package/dist/Editor/utils/SlateUtilityFunctions.js +38 -156
  78. package/dist/Editor/utils/button.js +14 -0
  79. package/dist/Editor/utils/draftToSlate.js +2 -3
  80. package/dist/Editor/utils/font.js +37 -40
  81. package/dist/Editor/utils/helper.js +20 -48
  82. package/dist/Editor/utils/link.js +1 -1
  83. package/package.json +2 -2
  84. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  85. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  86. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  87. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  88. package/dist/Editor/common/CustomDialog/index.js +0 -94
  89. package/dist/Editor/common/CustomDialog/style.js +0 -67
  90. package/dist/Editor/common/CustomSelect.js +0 -33
  91. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  92. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  93. package/dist/Editor/theme/index.js +0 -144
  94. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  95. package/dist/Editor/themeSettings/buttons/index.js +0 -283
  96. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  97. package/dist/Editor/themeSettings/colorTheme/index.js +0 -292
  98. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  99. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  100. package/dist/Editor/themeSettings/fonts/index.js +0 -220
  101. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  102. package/dist/Editor/themeSettings/icons.js +0 -60
  103. package/dist/Editor/themeSettings/index.js +0 -320
  104. package/dist/Editor/themeSettings/style.js +0 -152
  105. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  106. package/dist/Editor/themeSettingsAI/index.js +0 -356
  107. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -197
  108. package/dist/Editor/themeSettingsAI/style.js +0 -250
@@ -1,4 +1,4 @@
1
- import { Editor, Transforms, Element as SlateElement, Range } from "slate";
1
+ import { Editor, Transforms, Element as SlateElement } from "slate";
2
2
  import { Box } from "@mui/material";
3
3
  import { sizeMap } from "./font";
4
4
  import Link from "../Elements/Link/Link";
@@ -34,12 +34,12 @@ import SimpleText from "../Elements/SimpleText";
34
34
  import CheckList from "../Elements/List/CheckList";
35
35
  import { getTextColor, isEmptyTextNode } from "../helper";
36
36
  import Attachments from "../Elements/Attachments/Attachments";
37
- import { getBreakPointsValue, textThemeFields, getElementProperty } from "../helper/theme";
37
+ import { getBreakPointsValue, groupByBreakpoint } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
39
+ import insertNewLine from "./insertNewLine";
39
40
  import Divider from "../Elements/Divider/Divider";
40
41
  import { getBorderColor } from "./helper";
41
42
  import Code from "../Elements/EmbedScript/Code";
42
- import { ReactEditor } from "slate-react";
43
43
  import FreeGrid from "../Elements/FreeGrid/FreeGrid";
44
44
  import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
45
45
  import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
@@ -47,7 +47,7 @@ import DataView from "../Elements/DataView/DataView";
47
47
  import ViewData from "../Elements/DataView/Layouts/ViewData";
48
48
  import ColumnView from "../Elements/DataView/Layouts/ColumnView";
49
49
  import SearchAttachment from "../Elements/Search/SearchAttachment";
50
- import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
50
+ // import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
51
51
  import { jsx as _jsx } from "react/jsx-runtime";
52
52
  const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
53
53
  const list_types = ["orderedList", "unorderedList"];
@@ -55,17 +55,7 @@ const LIST_FORMAT_TYPE = {
55
55
  orderedList: "list-item",
56
56
  unorderedList: "list-item"
57
57
  };
58
-
59
- // const NEWLINESAFTER = [
60
- // "headingOne",
61
- // "headingTwo",
62
- // "headingThree",
63
- // "headingFour",
64
- // "headingFive",
65
- // "headingSix",
66
- // ];
67
-
68
- const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
58
+ const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
69
59
  export const toggleBlock = (editor, format, selection = true, attr = {}) => {
70
60
  const isActive = isBlockActive(editor, format);
71
61
  const isList = list_types.includes(format);
@@ -98,9 +88,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
98
88
  if (!selection) {
99
89
  Transforms.insertText(editor, "");
100
90
  }
101
- const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
102
91
  Transforms.setNodes(editor, {
103
- type: isActive ? forActiveType : isList ? LIST_FORMAT_TYPE[format] : format,
92
+ type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
104
93
  ...attr
105
94
  });
106
95
  if (isList && !isActive) {
@@ -109,12 +98,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
109
98
  children: []
110
99
  });
111
100
  }
112
-
113
- // if (NEWLINESAFTER.indexOf(format) > -1) {
114
- // insertNewLine(editor);
115
- // }
101
+ if (NEWLINESAFTER.indexOf(format) > -1) {
102
+ insertNewLine(editor);
103
+ }
116
104
  };
117
-
118
105
  export const addMarkData = (editor, data) => {
119
106
  try {
120
107
  Editor.addMark(editor, data.format, data.value);
@@ -123,14 +110,9 @@ export const addMarkData = (editor, data) => {
123
110
  }
124
111
  };
125
112
  export const toggleMark = (editor, format) => {
126
- const isActive = isMarkBtnActive(editor, format);
113
+ const isActive = isMarkActive(editor, format);
127
114
  if (isActive) {
128
- const isThemeSupportedMark = textThemeFields.some(f => f === format);
129
- if (isThemeSupportedMark) {
130
- Editor.addMark(editor, format, false);
131
- } else {
132
- Editor.removeMark(editor, format);
133
- }
115
+ Editor.removeMark(editor, format);
134
116
  } else {
135
117
  Editor.addMark(editor, format, true);
136
118
  }
@@ -144,52 +126,6 @@ export const isMarkActive = (editor, format) => {
144
126
  return null;
145
127
  }
146
128
  };
147
- export const isMarkBtnActive = (editor, format) => {
148
- switch (format) {
149
- case "bold":
150
- {
151
- const style = getSelectedElementStyle("font-weight", editor);
152
- return style === "700";
153
- }
154
- case "italic":
155
- {
156
- const style = getSelectedElementStyle("font-style", editor);
157
- return style === format;
158
- }
159
- // case "underline": {
160
- // const style = getSelectedElementStyle("text-decoration");
161
-
162
- // return style?.includes(format);
163
- // }
164
- // case "strikethrough": {
165
- // const style = getSelectedElementStyle("text-decoration");
166
-
167
- // return style?.includes("line-through");
168
- // }
169
- default:
170
- return isMarkActive(editor, format);
171
- }
172
- };
173
- export const getSelectedElementStyle = (styleProperty, editor) => {
174
- try {
175
- if (!editor.selection) {
176
- return "";
177
- }
178
- if (Range.isCollapsed(editor.selection)) {
179
- return "";
180
- }
181
- const domRange = ReactEditor.toDOMRange(editor, editor.selection);
182
- const selectedDomNode = domRange.commonAncestorContainer;
183
-
184
- // If it's a text node, get its parent element
185
- const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
186
- if (selectedElement) {
187
- return getElementProperty(selectedElement, styleProperty);
188
- }
189
- } catch (err) {
190
- console.log(err);
191
- }
192
- };
193
129
  export const isBlockActive = (editor, format) => {
194
130
  const [match] = Editor.nodes(editor, {
195
131
  match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
@@ -232,31 +168,6 @@ export const activeMark = (editor, format) => {
232
168
  return null;
233
169
  }
234
170
  };
235
-
236
- // to avoid the styles, that automatically assign from themes
237
- const getThemeMarkedLeaf = (leaf, children) => {
238
- const {
239
- italic,
240
- bold
241
- } = leaf || {};
242
- const style = {};
243
- if (italic === false) {
244
- style.fontStyle = "normal";
245
- }
246
- if (bold === false) {
247
- style.fontWeight = "normal";
248
- }
249
- if (Object.keys(style).length) {
250
- children = /*#__PURE__*/_jsx(Box, {
251
- component: "span",
252
- sx: {
253
- "& span": style
254
- },
255
- children: children
256
- });
257
- }
258
- return children;
259
- };
260
171
  export const getMarked = (leaf, children, theme) => {
261
172
  const className = leaf?.doublequote ? "doublequote" : "";
262
173
  if (leaf.highlight) {
@@ -283,7 +194,6 @@ export const getMarked = (leaf, children, theme) => {
283
194
  children: children
284
195
  });
285
196
  }
286
- children = getThemeMarkedLeaf(leaf, children);
287
197
  if (leaf.strikethrough) {
288
198
  children = /*#__PURE__*/_jsx("span", {
289
199
  style: {
@@ -311,27 +221,20 @@ export const getMarked = (leaf, children, theme) => {
311
221
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
312
222
  const family = leaf?.fontFamily;
313
223
  const textStyles = getTextColor(leaf?.color);
314
- const fontSize = {
315
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
316
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
317
- };
318
- const fontSizesImportant = {};
319
- Object.entries(fontSize).forEach(([key, value]) => {
320
- fontSizesImportant[key] = `${value} !important`;
321
- });
322
- const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
323
224
  children = /*#__PURE__*/_jsx("span", {
225
+ style: {
226
+ background: leaf.bgColor
227
+ },
324
228
  children: /*#__PURE__*/_jsx(Box, {
325
229
  className: className,
326
230
  component: "span",
327
231
  sx: {
328
- "& span": {
329
- // fontSize: fontSizesImportant,
330
- // ...groupByBreakpoint(fontSizesImportant, theme),
331
- background: leaf.bgColor,
332
- ...fontSizeWithBreakpoints
333
- },
334
- ...fontSizeWithBreakpoints,
232
+ ...groupByBreakpoint({
233
+ fontSize: {
234
+ lg: sizeMap[leaf.fontSize] || leaf.fontSize,
235
+ ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
236
+ }
237
+ }, theme),
335
238
  // ...wrapThemeBreakpoints(
336
239
  // {
337
240
  // lg: sizeMap[leaf.fontSize] || leaf.fontSize,
@@ -373,71 +276,55 @@ export const getBlock = props => {
373
276
  } = props;
374
277
  const attributes = props.attributes ?? {};
375
278
  const isEmpty = isEmptyTextNode(element);
376
- const commonHeadingProps = () => ({
377
- ...attributes,
378
- ...element.attr,
379
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
380
- });
381
- const commonParaProps = paraType => ({
382
- ...attributes,
383
- ...element.attr,
384
- className: `content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
385
- });
386
279
  switch (element.type) {
387
280
  case "headingOne":
388
281
  return /*#__PURE__*/_jsx("h1", {
389
- ...commonHeadingProps(),
282
+ ...attributes,
283
+ ...element.attr,
284
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
390
285
  placeholder: "Heading 1",
391
286
  children: children
392
287
  });
393
288
  case "headingTwo":
394
289
  return /*#__PURE__*/_jsx("h2", {
395
- ...commonHeadingProps(),
290
+ ...attributes,
291
+ ...element.attr,
292
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
396
293
  placeholder: "Heading 2",
397
294
  children: children
398
295
  });
399
296
  case "headingThree":
400
297
  return /*#__PURE__*/_jsx("h3", {
401
- ...commonHeadingProps(),
298
+ ...attributes,
299
+ ...element.attr,
300
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
402
301
  placeholder: "Heading 3",
403
302
  children: children
404
303
  });
405
304
  case "headingFour":
406
305
  return /*#__PURE__*/_jsx("h4", {
407
- ...commonHeadingProps(),
306
+ ...attributes,
307
+ ...element.attr,
308
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
408
309
  placeholder: "Heading 4",
409
310
  children: children
410
311
  });
411
312
  case "headingFive":
412
313
  return /*#__PURE__*/_jsx("h5", {
413
- ...commonHeadingProps(),
314
+ ...attributes,
315
+ ...element.attr,
316
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
414
317
  placeholder: "Heading 5",
415
318
  children: children
416
319
  });
417
320
  case "headingSix":
418
321
  return /*#__PURE__*/_jsx("h6", {
419
- ...commonHeadingProps(),
322
+ ...attributes,
323
+ ...element.attr,
324
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
420
325
  placeholder: "Heading 6",
421
326
  children: children
422
327
  });
423
- case "paragraphOne":
424
- return /*#__PURE__*/_jsx("p", {
425
- ...commonParaProps("para1"),
426
- placeholder: "Paragraph 1",
427
- children: children
428
- });
429
- case "paragraphTwo":
430
- return /*#__PURE__*/_jsx("p", {
431
- ...commonParaProps("para2"),
432
- placeholder: "Paragraph 2",
433
- children: children
434
- });
435
- case "paragraphThree":
436
- return /*#__PURE__*/_jsx("p", {
437
- ...commonParaProps("para3"),
438
- placeholder: "Paragraph 3",
439
- children: children
440
- });
441
328
  case "blockquote":
442
329
  return /*#__PURE__*/_jsx("blockquote", {
443
330
  ...attributes,
@@ -733,11 +620,6 @@ export const getBlock = props => {
733
620
  children: children
734
621
  });
735
622
  default:
736
- // return (
737
- // <span {...attributes} {...element.attr}>
738
- // {children}
739
- // </span>
740
- // );
741
623
  return /*#__PURE__*/_jsx(SimpleText, {
742
624
  ...props,
743
625
  isEmpty: isEmpty
@@ -11,6 +11,20 @@ export const insertButton = editor => {
11
11
  linkType: "webAddress"
12
12
  },
13
13
  iconPosition: "start",
14
+ bgColor: "#2563EB",
15
+ textColor: "#FFF",
16
+ borderRadius: {
17
+ topLeft: 30,
18
+ topRight: 30,
19
+ bottomLeft: 30,
20
+ bottomRight: 30
21
+ },
22
+ bannerSpacing: {
23
+ left: 16,
24
+ top: 8,
25
+ right: 16,
26
+ bottom: 8
27
+ },
14
28
  ...(windowVar.lastButtonProps || {})
15
29
  };
16
30
  Transforms.insertNodes(editor, button);
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
82
82
  };
83
83
  export const draftToSlate = props => {
84
84
  const {
85
- data,
86
- needLayout
85
+ data
87
86
  } = props;
88
87
  if (data?.blocks && data?.blocks?.length > 0) {
89
88
  const converted = data?.blocks?.reduce((a, b) => {
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
105
104
  return data;
106
105
  } else {
107
106
  return [{
108
- type: needLayout ? "title" : "paragraph",
107
+ type: "paragraph",
109
108
  children: [{
110
109
  text: ""
111
110
  }]
@@ -7,43 +7,43 @@ export const sizeMap = {
7
7
  export const fontFamilyMap = {
8
8
  PoppinsRegular: "PoppinsRegular",
9
9
  PoppinsBold: "PoppinsBold",
10
- sans: 'Helvetica, Arial, "sans serif"',
11
- serif: 'Georgia, "Times New Roaman", serif',
12
- monospace: 'Monaco, "Courier New", monospace',
13
- roboto: "Roboto, sans-serif",
14
- qwitcher: '"Qwitcher Grypen", cursive',
15
- garamond: '"EB Garamond", serif',
16
- anton: "Anton, sans-serif",
17
- dmserif: '"DM Serif Text", serif',
18
- inter: "Inter, sans-serif",
19
- libre: '"Libre Baskerville", serif',
20
- montserrat: "Montserrat, sans-serif",
21
- opensans: '"Open Sans", sans-serif',
22
- publicsans: '"Public Sans", sans-serif',
23
- raleway: "Raleway, sans-serif",
24
- spacemono: '"Space Mono", sans-serif',
25
- bulgarian: '"Bulgarian Garamond", monospace',
26
- impact: "Impact, serif",
27
- redacted: '"Redacted Script", cursive',
28
- greatVibes: '"Great Vibes", cursive',
29
- zeyada: "Zeyada, cursive",
30
- allura: "Allura, cursive",
31
- pinyon: '"Pinyon Script", cursive',
32
- muellerhoff: '"Herr Von Muellerhoff", cursive',
33
- dawning: '"Dawning of a New Day", cursive',
10
+ sans: "Helvetica,Arial, sans serif",
11
+ serif: "Georgia, Times New Roaman,serif",
12
+ monospace: "Monaco, Courier New,monospace",
13
+ roboto: "'Roboto', sans-serif",
14
+ qwitcher: "'Qwitcher Grypen', cursive",
15
+ garamond: "'EB Garamond', serif",
16
+ anton: "'Anton', sans-serif",
17
+ dmserif: "'DM Serif Text', serif",
18
+ inter: "'Inter', sans-serif",
19
+ libre: "'Libre Baskerville', serif",
20
+ montserrat: "'Montserrat', sans-serif",
21
+ opensans: "'Open Sans', sans-serif",
22
+ publicsans: "'Public Sans', sans-serif",
23
+ raleway: "'Raleway', sans-serif",
24
+ spacemono: "'Space Mono', sans-serif",
25
+ bulgarian: "'Bulgarian Garamond', monospace",
26
+ impact: "'Impact', serif",
27
+ redacted: "'Redacted Script', cursive",
28
+ greatVibes: "'Great Vibes', cursive",
29
+ zeyada: "'Zeyada', cursive",
30
+ allura: "'Allura', cursive",
31
+ pinyon: "'Pinyon Script', cursive",
32
+ muellerhoff: "'Herr Von Muellerhoff', cursive",
33
+ dawning: "'Dawning of a New Day', cursive",
34
34
  // New Font Added for Type Signature
35
- comingsoon: '"Coming Soon", cursive',
36
- dancingScript: '"Dancing Script", cursive',
37
- engagement: "Engagement, cursive",
38
- gaegu: "Gaegu, cursive",
39
- ingridDarling: '"Ingrid Darling", cursive',
40
- kitaOne: "Times",
41
- laBelleAurore: '"La Belle Aurore", cursive',
42
- lobster: "Lobster, cursive",
43
- meaCulpa: '"Mea Culpa", cursive',
44
- meddon: "Meddon, cursive",
45
- merriWeather: "Merriweather, serif",
46
- theGirlNextDoor: '"The Girl Next Door", cursive'
35
+ comingsoon: "'Coming Soon', cursive",
36
+ dancingScript: "'Dancing Script', cursive",
37
+ engagement: "'Engagement', cursive",
38
+ gaegu: "'Gaegu', cursive",
39
+ ingridDarling: "'Ingrid Darling', cursive",
40
+ kitaOne: "'Kite One', sans - serif",
41
+ laBelleAurore: "'La Belle Aurore', cursive",
42
+ lobster: "'Lobster', cursive",
43
+ meaCulpa: "'Mea Culpa', cursive",
44
+ meddon: "'Meddon', cursive",
45
+ merriWeather: "'Merriweather', serif",
46
+ theGirlNextDoor: "'The Girl Next Door', cursive"
47
47
  };
48
48
  export const fontOptions = Object.keys(fontFamilyMap).map(m => {
49
49
  return {
@@ -62,10 +62,7 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
62
62
  export const headingMap = {
63
63
  headingOne: "32px",
64
64
  headingTwo: "24px",
65
- headingThree: "19px",
66
- headingFour: "16px",
67
- headingFive: "13px",
68
- headingSix: "11px"
65
+ headingThree: "19px"
69
66
  };
70
67
  export const fontWeightOptions = [{
71
68
  text: "Bold",
@@ -464,34 +464,6 @@ export const decodeString = str => {
464
464
  console.log(err);
465
465
  }
466
466
  };
467
- export const getContrastColor = color => {
468
- let r, g, b;
469
-
470
- // Check if the color is in hex format
471
- if (color.startsWith("#")) {
472
- r = parseInt(color.substring(1, 3), 16);
473
- g = parseInt(color.substring(3, 5), 16);
474
- b = parseInt(color.substring(5, 7), 16);
475
- }
476
- // Check if the color is in RGB/RGBA format
477
- else if (color.startsWith("rgb")) {
478
- const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
479
- .split(","); // Split the values into an array
480
-
481
- r = parseInt(rgbValues[0]);
482
- g = parseInt(rgbValues[1]);
483
- b = parseInt(rgbValues[2]);
484
- } else {
485
- // If the format is not recognized, default to black text
486
- return "#000000";
487
- }
488
-
489
- // Calculate relative luminance
490
- const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
491
-
492
- // Return black for light colors, white for dark colors
493
- return luminance > 0.5 ? "#000000" : "#FFFFFF";
494
- };
495
467
  export const onDeleteKey = (event, {
496
468
  editor
497
469
  }) => {
@@ -653,10 +625,6 @@ export const isRestrictedNode = (event, editor) => {
653
625
  return isNodeRestricted;
654
626
  }
655
627
  };
656
- export function capitalizeFirstLetter(str) {
657
- if (!str) return str;
658
- return str.charAt(0).toUpperCase() + str.slice(1);
659
- }
660
628
  export const insertLineBreakAtEndOfPath = (editor, path) => {
661
629
  try {
662
630
  const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
@@ -675,13 +643,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
675
643
  console.log(err);
676
644
  }
677
645
  };
678
- export function isHavingSelection(editor) {
679
- try {
680
- return editor?.selection && !Range.isCollapsed(editor.selection);
681
- } catch (err) {
682
- console.log(err);
683
- }
684
- }
685
646
  const omitNodes = ["site-settings", "page-settings"];
686
647
  export function getInitialValue(value = [], readOnly) {
687
648
  if (readOnly === "readonly" && value?.length) {
@@ -712,17 +673,20 @@ export function getInitialValue(value = [], readOnly) {
712
673
  }
713
674
  return value;
714
675
  }
676
+ export function capitalizeFirstLetter(str) {
677
+ if (!str) return str;
678
+ return str.charAt(0).toUpperCase() + str.slice(1);
679
+ }
680
+ export function isHavingSelection(editor) {
681
+ try {
682
+ return editor?.selection && !Range.isCollapsed(editor.selection);
683
+ } catch (err) {
684
+ console.log(err);
685
+ }
686
+ }
715
687
  export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
716
688
  return `${defaultCls} ${selected ? selectedClsName : ""}`;
717
689
  }
718
- export function handleNegativeInteger(val) {
719
- return val < 0 ? 0 : val;
720
- }
721
- export const containsSurrogatePair = text => {
722
- // Match surrogate pairs (high and low surrogate)
723
- const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
724
- return surrogatePairRegex.test(text);
725
- };
726
690
  export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
727
691
  try {
728
692
  const options = {
@@ -736,6 +700,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
736
700
  return [];
737
701
  }
738
702
  };
703
+ export const containsSurrogatePair = text => {
704
+ // Match surrogate pairs (high and low surrogate)
705
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
706
+ return surrogatePairRegex.test(text);
707
+ };
739
708
  export const getSlateDom = (editor, range) => {
740
709
  try {
741
710
  const slateDom = ReactEditor.toDOMRange(editor, range);
@@ -784,4 +753,7 @@ export const viewSlateSelection = () => {
784
753
  export const hideSlateSelection = () => {
785
754
  const root = document.documentElement;
786
755
  root.style.setProperty("--slate-highlight-bg", "none");
787
- };
756
+ };
757
+ export function handleNegativeInteger(val) {
758
+ return val < 0 ? 0 : val;
759
+ }
@@ -3,7 +3,7 @@ import { isBlockActive } from "./SlateUtilityFunctions";
3
3
  export const createLinkNode = (href, showInNewTab, text, linkType) => ({
4
4
  type: "link",
5
5
  href,
6
- target: showInNewTab === "_blank" ? "_blank" : "_self",
6
+ target: showInNewTab ? "_blank" : "_self",
7
7
  linkType,
8
8
  children: [{
9
9
  text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.9.8",
3
+ "version": "6.0.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -69,7 +69,7 @@
69
69
  "storybook": "storybook dev -p 6006",
70
70
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
71
71
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
72
- "publish:local": "rm -rf /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist --copy-files"
72
+ "publish:local": "rm -rf /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist --copy-files"
73
73
  },
74
74
  "eslintConfig": {
75
75
  "extends": [