@flozy/editor 10.6.4 → 10.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/Editor/ChatEditor.js +16 -17
  2. package/dist/Editor/CommonEditor.js +14 -129
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +11 -57
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
  6. package/dist/Editor/Elements/AI/Styles.js +0 -1
  7. package/dist/Editor/Elements/Accordion/Accordion.js +9 -45
  8. package/dist/Editor/Elements/Accordion/AccordionSummary.js +23 -1
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -10
  10. package/dist/Editor/Elements/Button/EditorButton.js +10 -26
  11. package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -2
  12. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  15. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/{SelectV1.js → MultiSelect.js} +69 -125
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +10 -10
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +9 -28
  19. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -12
  20. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +14 -40
  21. package/dist/Editor/Elements/Divider/Divider.js +1 -1
  22. package/dist/Editor/Elements/Embed/Embed.css +0 -4
  23. package/dist/Editor/Elements/Embed/Video.js +1 -1
  24. package/dist/Editor/Elements/Form/Form.js +3 -3
  25. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -0
  26. package/dist/Editor/Elements/Form/FormField.js +1 -1
  27. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  28. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +31 -35
  29. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -7
  30. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -1
  31. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  32. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
  33. package/dist/Editor/Elements/FreeGrid/styles.js +0 -14
  34. package/dist/Editor/Elements/Grid/Grid.js +2 -14
  35. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  36. package/dist/Editor/Elements/Signature/Signature.css +1 -2
  37. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +5 -18
  38. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +3 -16
  39. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  40. package/dist/Editor/Elements/Table/AddRowCol.js +2 -8
  41. package/dist/Editor/Elements/Table/DragButton.js +1 -0
  42. package/dist/Editor/Elements/Table/Draggable.js +2 -6
  43. package/dist/Editor/Elements/Table/Styles.js +0 -7
  44. package/dist/Editor/Elements/Table/Table.js +3 -3
  45. package/dist/Editor/Elements/Table/TableCell.js +5 -24
  46. package/dist/Editor/Elements/Title/title.js +11 -8
  47. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  48. package/dist/Editor/MiniEditor.js +1 -2
  49. package/dist/Editor/Styles/EditorStyles.js +4 -4
  50. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  51. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  52. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  53. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  54. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  55. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
  56. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  57. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  58. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
  59. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  60. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -73
  61. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +10 -58
  62. package/dist/Editor/Toolbar/PopupTool/index.js +5 -12
  63. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  64. package/dist/Editor/common/ColorPickerButton.js +16 -41
  65. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  66. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  67. package/dist/Editor/common/Icon.js +0 -28
  68. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  69. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  70. package/dist/Editor/common/LinkSettings/NavComponents.js +63 -47
  71. package/dist/Editor/common/LinkSettings/index.js +28 -17
  72. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  73. package/dist/Editor/common/LinkSettings/style.js +244 -164
  74. package/dist/Editor/common/RnD/ElementOptions/Actions.js +5 -4
  75. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  76. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +3 -4
  77. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  78. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  80. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  81. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  82. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  83. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  84. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  86. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  87. package/dist/Editor/common/RnD/OptionsPopup/style.js +1 -0
  88. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -11
  89. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  90. package/dist/Editor/common/RnD/Utils/gridDropItem.js +19 -28
  91. package/dist/Editor/common/RnD/Utils/index.js +25 -58
  92. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -42
  93. package/dist/Editor/common/RnD/VirtualElement/helper.js +132 -323
  94. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -16
  95. package/dist/Editor/common/RnD/index.js +38 -72
  96. package/dist/Editor/common/Select/index.js +7 -44
  97. package/dist/Editor/common/Select/styles.js +2 -30
  98. package/dist/Editor/common/Shorthands/elements.js +0 -54
  99. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  100. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +9 -12
  101. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  102. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
  103. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  104. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  105. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  106. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
  107. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
  108. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
  109. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  110. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -2
  111. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  112. package/dist/Editor/common/SwipeableDrawer/style.js +12 -14
  113. package/dist/Editor/common/Uploader.js +0 -16
  114. package/dist/Editor/common/iconListV2.js +0 -76
  115. package/dist/Editor/common/iconslist.js +0 -21
  116. package/dist/Editor/commonStyle.js +61 -116
  117. package/dist/Editor/helper/deserialize/index.js +4 -6
  118. package/dist/Editor/helper/index.js +2 -6
  119. package/dist/Editor/helper/theme.js +2 -203
  120. package/dist/Editor/hooks/useMouseMove.js +3 -9
  121. package/dist/Editor/hooks/useTable.js +4 -5
  122. package/dist/Editor/plugins/withCustomDeleteBackward.js +1 -6
  123. package/dist/Editor/plugins/withEmbeds.js +1 -1
  124. package/dist/Editor/plugins/withHTML.js +5 -14
  125. package/dist/Editor/plugins/withTable.js +1 -1
  126. package/dist/Editor/theme/ThemeList.js +173 -50
  127. package/dist/Editor/utils/SlateUtilityFunctions.js +50 -173
  128. package/dist/Editor/utils/accordion.js +37 -158
  129. package/dist/Editor/utils/button.js +17 -1
  130. package/dist/Editor/utils/customHooks/useTableResize.js +9 -49
  131. package/dist/Editor/utils/draftToSlate.js +2 -3
  132. package/dist/Editor/utils/events.js +6 -18
  133. package/dist/Editor/utils/font.js +37 -40
  134. package/dist/Editor/utils/formfield.js +0 -1
  135. package/dist/Editor/utils/helper.js +30 -149
  136. package/dist/Editor/utils/insertAppHeader.js +5 -9
  137. package/dist/Editor/utils/signature.js +9 -2
  138. package/package.json +4 -4
  139. package/dist/Editor/Elements/FreeGrid/helper.js +0 -115
  140. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
  141. package/dist/Editor/assets/svg/BackIcon.js +0 -18
  142. package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
  143. package/dist/Editor/common/Checkbox/index.js +0 -46
  144. package/dist/Editor/common/Checkbox/styles.js +0 -45
  145. package/dist/Editor/common/CustomColorPicker/index.js +0 -130
  146. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  147. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  148. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  149. package/dist/Editor/common/CustomSelect.js +0 -43
  150. package/dist/Editor/common/RadioGroup/index.js +0 -48
  151. package/dist/Editor/common/RadioGroup/styles.js +0 -29
  152. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  153. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
  154. package/dist/Editor/helper/textIndeces.js +0 -58
  155. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  156. package/dist/Editor/hooks/useThemeValues.js +0 -63
  157. package/dist/Editor/theme/index.js +0 -149
  158. package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
  159. package/dist/Editor/themeSettings/buttons/index.js +0 -300
  160. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  161. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  162. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  163. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  164. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  165. package/dist/Editor/themeSettings/fonts/style.js +0 -62
  166. package/dist/Editor/themeSettings/icons.js +0 -60
  167. package/dist/Editor/themeSettings/index.js +0 -380
  168. package/dist/Editor/themeSettings/style.js +0 -299
  169. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  170. package/dist/Editor/themeSettingsAI/index.js +0 -355
  171. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
  172. package/dist/Editor/themeSettingsAI/style.js +0 -332
  173. package/dist/Editor/utils/updateFormName.js +0 -22
@@ -1,10 +1,9 @@
1
- import { useRef, useState } from "react";
1
+ import { useState } from "react";
2
2
  const useTableResize = ({
3
3
  parentDOM,
4
4
  size: defaultSize,
5
5
  onDone,
6
- minMaxProps = {},
7
- isMobile
6
+ minMaxProps = {}
8
7
  }) => {
9
8
  const {
10
9
  width
@@ -19,10 +18,6 @@ const useTableResize = ({
19
18
  });
20
19
  const [resizing, setResizing] = useState(false);
21
20
  const [isDone, setIsDone] = useState(0);
22
- const lastTouch = useRef({
23
- x: 0,
24
- y: 0
25
- });
26
21
  const onLoad = defaultSize => {
27
22
  setSize({
28
23
  widthInPercent: 100,
@@ -30,64 +25,29 @@ const useTableResize = ({
30
25
  ...defaultSize
31
26
  });
32
27
  };
33
- const handleEventListeners = type => {
34
- const listener = type === "add" ? document.addEventListener : document.removeEventListener;
35
- const onMoveListener = isMobile ? "touchmove" : "pointermove";
36
- const onEndListener = isMobile ? "touchend" : "pointerup";
37
- listener(onMoveListener, onMouseMove);
38
- listener(onEndListener, onMouseUp);
39
- };
40
- const updateLastTouch = ({
41
- clientX,
42
- clientY
43
- }) => {
44
- lastTouch.current.x = clientX;
45
- lastTouch.current.y = clientY;
46
- };
47
28
  const onMouseDown = e => {
48
- if (isMobile) {
49
- updateLastTouch(e.touches[0]);
50
- } else {
51
- e.preventDefault();
52
- }
53
- handleEventListeners("add");
29
+ e.preventDefault();
30
+ document.addEventListener("pointermove", onMouseMove);
31
+ document.addEventListener("pointerup", onMouseUp);
54
32
  setResizing(true);
55
33
  setIsDone(0);
56
34
  };
57
35
  const onMouseUp = () => {
58
- handleEventListeners("remove");
36
+ document.removeEventListener("pointermove", onMouseMove);
37
+ document.removeEventListener("pointerup", onMouseUp);
59
38
  setResizing(false);
60
39
  setIsDone(1);
61
40
  };
62
41
  const onMouseMove = e => {
63
- let {
64
- movementX,
65
- movementY
66
- } = e || {};
67
- if (e.type === "touchmove") {
68
- // for mobile
69
- const {
70
- x,
71
- y
72
- } = lastTouch.current || {};
73
- const touches = e.touches[0];
74
- const {
75
- clientX,
76
- clientY
77
- } = touches;
78
- movementX = clientX - x;
79
- movementY = clientY - y;
80
- updateLastTouch(touches);
81
- }
82
42
  const {
83
43
  minWidth
84
44
  } = minMaxProps || {};
85
45
  setSize(currentSize => {
86
46
  const width = currentSize?.width || parentDOM?.clientWidth;
87
- const calcWidth = width + movementX;
47
+ const calcWidth = width + e.movementX;
88
48
  return {
89
49
  width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
90
- height: currentSize.height + movementY,
50
+ height: currentSize.height + e.movementY,
91
51
  widthInPercent: calcWidth / width * 100
92
52
  };
93
53
  });
@@ -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
  }]
@@ -1,8 +1,8 @@
1
- import { Editor, Transforms, Element, Node, Path, Range, Point } from "slate";
1
+ import { Editor, Transforms, Element, Node, Path, Range } from "slate";
2
2
  import { toggleBlock } from "./SlateUtilityFunctions";
3
3
  import insertNewLine from "./insertNewLine";
4
4
  import { insertAccordion } from "./accordion";
5
- import { getNode, isListItem } from "./helper";
5
+ import { isListItem } from "./helper";
6
6
  import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
7
7
  import EDITORCMDS from "../common/EditorCmds";
8
8
  const HOTKEYS = {
@@ -183,20 +183,6 @@ const checkListEnterEvent = (editor, type) => {
183
183
  insertNewLine(editor);
184
184
  }
185
185
  };
186
- export const removeAccordion = (editor, accordionPath) => {
187
- const accordion = getNode(editor, accordionPath);
188
- Transforms.removeNodes(editor, {
189
- at: accordionPath
190
- });
191
- const insertNodes = [];
192
- accordion.children.forEach(a => {
193
- a.children.forEach(n => insertNodes.push(n));
194
- });
195
- Transforms.insertNodes(editor, insertNodes, {
196
- at: accordionPath,
197
- select: true
198
- });
199
- };
200
186
  export const enterEvent = (e, editor, isMobile) => {
201
187
  try {
202
188
  const ele = isListItem(editor);
@@ -239,7 +225,9 @@ export const enterEvent = (e, editor, isMobile) => {
239
225
  e.preventDefault();
240
226
  if (!text) {
241
227
  const accordionIndex = ele[1].slice(0, Math.max(ele[1].length - 1));
242
- removeAccordion(editor, accordionIndex);
228
+ Transforms.removeNodes(editor, {
229
+ at: accordionIndex
230
+ });
243
231
  } else {
244
232
  const nextPath = Path.next(Path.parent(ele[1]));
245
233
  insertAccordion(editor, nextPath);
@@ -360,7 +348,7 @@ export const upDownArrowKeyEvents = (e, editor) => {
360
348
  }
361
349
  Transforms.move(editor, {
362
350
  distance: 0,
363
- unit: "offset",
351
+ unit: 'offset',
364
352
  reverse: false
365
353
  });
366
354
  Transforms.select(editor, {
@@ -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",
@@ -7,7 +7,6 @@ export const formField = data => {
7
7
  name: `field_${new Date().getTime()}`,
8
8
  key: `field_${new Date().getTime()}`,
9
9
  label: `field_${new Date().getTime()}`,
10
- uid: `field_${new Date().getTime()}`,
11
10
  placeholder: "Placeholder...",
12
11
  children: [{
13
12
  text: ""
@@ -2,8 +2,6 @@ import { Editor, Node, Transforms, Element, Path, Range, Text } from "slate";
2
2
  import { ReactEditor } from "slate-react";
3
3
  import insertNewLine from "./insertNewLine";
4
4
  import { getDevice } from "../helper/theme";
5
- import { activeMark, getSelectedElementStyle } from "./SlateUtilityFunctions";
6
- import { getCurrentElementText } from "../plugins/withHTML";
7
5
  export const windowVar = {};
8
6
  let ST_TIMEOUT = null;
9
7
  const BLOCKS = ["grid", "dataView"];
@@ -218,13 +216,9 @@ export const handleInsertLastElement = (event, editor) => {
218
216
  };
219
217
  export const isListItem = editor => {
220
218
  const format = ["list-item", "check-list-item", "accordion-summary", "headingOne", "headingTwo", "headingThree"];
221
- const [node1, node2] = Editor.nodes(editor, {
219
+ const [node] = Editor.nodes(editor, {
222
220
  match: n => !Editor.isEditor(n) && Element.isElement(n) && format.indexOf(n.type) > -1
223
221
  });
224
- let node = node1;
225
- if (node2 && node2[0] && node2[0].type === "accordion-summary") {
226
- node = node2;
227
- }
228
222
  return node;
229
223
  };
230
224
  export const getNode = (editor, path) => {
@@ -339,8 +333,7 @@ const handleLinkBtnClick = (e, props, isMobilePreview, metadata) => {
339
333
  }
340
334
  }
341
335
  };
342
- export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}, metadata = {}, isEditMode, isCustomMobile // for drawer in App Header
343
- ) => {
336
+ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}, metadata = {}) => {
344
337
  const props = {};
345
338
  if (!readOnly) {
346
339
  return {
@@ -372,9 +365,6 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
372
365
  case "page":
373
366
  const [page = "", section] = url?.split("#") || [];
374
367
  const sec = section ? `#${section}` : "";
375
- if (isEditMode) {
376
- break;
377
- }
378
368
  if (page === "_currentPage") {
379
369
  props.component = "button";
380
370
  props.onClick = () => {
@@ -395,12 +385,11 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
395
385
  const currentUserPage = getCurrentUserPage();
396
386
  props.href = isCurrentPage(page) ? `./${currentUserPage}${sec}` : `./${url}`;
397
387
  if (openInNewTab) {
398
- // if (isCurrentPage(page)) {
399
- // // temp fix, if user is presented in current page, open in new tab option is restricted, we will scroll to the element in current page
400
- // } else {
401
- // props.target = "_blank";
402
- // }
403
- props.target = "_blank";
388
+ if (isCurrentPage(page)) {
389
+ // temp fix, if user is presented in current page, open in new tab option is restricted, we will scroll to the element in current page
390
+ } else {
391
+ props.target = "_blank";
392
+ }
404
393
  }
405
394
  }
406
395
  break;
@@ -435,7 +424,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
435
424
 
436
425
  // for iphone fix
437
426
  if (props.component === "a" && props.href) {
438
- const isMobile = isCustomMobile || getDevice(window.innerWidth) === "xs";
427
+ const isMobile = getDevice(window.innerWidth) === "xs";
439
428
  if (isMobile) {
440
429
  props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
441
430
  }
@@ -496,34 +485,6 @@ export const decodeString = str => {
496
485
  console.log(err);
497
486
  }
498
487
  };
499
- export const getContrastColor = color => {
500
- let r, g, b;
501
-
502
- // Check if the color is in hex format
503
- if (color.startsWith("#")) {
504
- r = parseInt(color.substring(1, 3), 16);
505
- g = parseInt(color.substring(3, 5), 16);
506
- b = parseInt(color.substring(5, 7), 16);
507
- }
508
- // Check if the color is in RGB/RGBA format
509
- else if (color.startsWith("rgb")) {
510
- const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
511
- .split(","); // Split the values into an array
512
-
513
- r = parseInt(rgbValues[0]);
514
- g = parseInt(rgbValues[1]);
515
- b = parseInt(rgbValues[2]);
516
- } else {
517
- // If the format is not recognized, default to black text
518
- return "#000000";
519
- }
520
-
521
- // Calculate relative luminance
522
- const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
523
-
524
- // Return black for light colors, white for dark colors
525
- return luminance > 0.5 ? "#000000" : "#FFFFFF";
526
- };
527
488
  export const onDeleteKey = (event, {
528
489
  editor
529
490
  }) => {
@@ -741,10 +702,6 @@ export const isRestrictedNode = (event, editor) => {
741
702
  return isNodeRestricted;
742
703
  }
743
704
  };
744
- export function capitalizeFirstLetter(str) {
745
- if (!str) return str;
746
- return str.charAt(0).toUpperCase() + str.slice(1);
747
- }
748
705
  export const insertLineBreakAtEndOfPath = (editor, path) => {
749
706
  try {
750
707
  const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
@@ -763,13 +720,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
763
720
  console.log(err);
764
721
  }
765
722
  };
766
- export function isHavingSelection(editor) {
767
- try {
768
- return editor?.selection && !Range.isCollapsed(editor.selection);
769
- } catch (err) {
770
- console.log(err);
771
- }
772
- }
773
723
  const omitNodes = ["site-settings", "page-settings"];
774
724
  export function getInitialValue(value = [], readOnly) {
775
725
  if (readOnly === "readonly" && value?.length) {
@@ -800,17 +750,20 @@ export function getInitialValue(value = [], readOnly) {
800
750
  }
801
751
  return value;
802
752
  }
753
+ export function capitalizeFirstLetter(str) {
754
+ if (!str) return str;
755
+ return str.charAt(0).toUpperCase() + str.slice(1);
756
+ }
757
+ export function isHavingSelection(editor) {
758
+ try {
759
+ return editor?.selection && !Range.isCollapsed(editor.selection);
760
+ } catch (err) {
761
+ console.log(err);
762
+ }
763
+ }
803
764
  export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
804
765
  return `${defaultCls} ${selected ? selectedClsName : ""}`;
805
766
  }
806
- export function handleNegativeInteger(val) {
807
- return val < 0 ? 0 : val;
808
- }
809
- export const containsSurrogatePair = text => {
810
- // Match surrogate pairs (high and low surrogate)
811
- const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
812
- return surrogatePairRegex.test(text);
813
- };
814
767
  export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
815
768
  try {
816
769
  const options = {
@@ -824,6 +777,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
824
777
  return [];
825
778
  }
826
779
  };
780
+ export const containsSurrogatePair = text => {
781
+ // Match surrogate pairs (high and low surrogate)
782
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
783
+ return surrogatePairRegex.test(text);
784
+ };
827
785
  export const getSlateDom = (editor, range) => {
828
786
  try {
829
787
  const slateDom = ReactEditor.toDOMRange(editor, range);
@@ -864,8 +822,7 @@ export const clearWindowSelection = () => {
864
822
 
865
823
  export const viewSlateSelection = () => {
866
824
  // if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
867
- // clearWindowSelection();
868
-
825
+ clearWindowSelection();
869
826
  const selectionBg = "rgba(35, 131, 226, 0.35)";
870
827
  const root = document.documentElement;
871
828
  root.style.setProperty("--slate-highlight-bg", selectionBg);
@@ -874,24 +831,9 @@ export const hideSlateSelection = () => {
874
831
  const root = document.documentElement;
875
832
  root.style.setProperty("--slate-highlight-bg", "none");
876
833
  };
877
- export const insertSlashNode = (editor, insertNode) => {
878
- try {
879
- // Delete the currently selected text
880
- editor.deleteFragment();
881
- const currentText = getCurrentElementText(editor);
882
- const currentPath = editor?.selection?.anchor?.path;
883
- let insertAt = currentPath;
884
- if (currentText?.trim()) {
885
- const parentPath = Path.parent(currentPath);
886
- insertAt = Path.next(parentPath);
887
- }
888
- Transforms.insertNodes(editor, insertNode, {
889
- at: insertAt
890
- });
891
- } catch (err) {
892
- console.log(err);
893
- }
894
- };
834
+ export function handleNegativeInteger(val) {
835
+ return val < 0 ? 0 : val;
836
+ }
895
837
  export const isEverythingSelected = editor => {
896
838
  const {
897
839
  selection
@@ -922,61 +864,6 @@ export const getCurrentNodeText = editor => {
922
864
  console.log("Error:", error);
923
865
  }
924
866
  };
925
- function convertColorToRgb(color) {
926
- if (color?.startsWith("#")) {
927
- // HEX to RGB
928
- let hex = color.replace("#", "");
929
- let r, g, b;
930
- if (hex.length === 3) {
931
- hex = hex.split("").map(x => x + x).join("");
932
- }
933
- if (hex.length === 6) {
934
- [r, g, b] = [hex.substring(0, 2), hex.substring(2, 4), hex.substring(4, 6)].map(val => parseInt(val, 16));
935
- return `rgb(${r}, ${g}, ${b})`;
936
- }
937
- } else {
938
- return color;
939
- }
940
- }
941
- export const getSelectedColor = (selectedColor, theme, hideThemeColors) => {
942
- const colorVars = hideThemeColors ? null : theme?.vars?.colors;
943
- let selectedValue = selectedColor;
944
- if (colorVars) {
945
- const convertedColor = convertColorToRgb(selectedColor);
946
- Object.entries(theme.colors).forEach(([key, value]) => {
947
- const convertedThemeColor = convertColorToRgb(value);
948
- if (convertedThemeColor === convertedColor) {
949
- selectedValue = colorVars[key];
950
- }
951
- });
952
- }
953
- return selectedValue;
954
- };
955
- const themeTextFormats = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
956
- export const getSelectedElementColor = (editor, format, theme) => {
957
- const [isThemeText] = Editor.nodes(editor, {
958
- at: editor.selection,
959
- match: n => themeTextFormats.includes(n?.type)
960
- });
961
- if (!isThemeText) {
962
- return activeMark(editor, "color") || "#000000";
963
- }
964
- const color = getSelectedElementStyle(format, editor, format);
965
- return getSelectedColor(color, theme);
966
- };
967
- export const isHavingColor = color => {
968
- if (!color) {
969
- return false;
970
- }
971
- if (color.includes("rgba")) {
972
- const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*(\d*\.?\d+)?\)/);
973
- if (!match) return false; // Invalid format
974
-
975
- const alpha = match[4] !== undefined ? parseFloat(match[4]) : 1; // Default alpha = 1
976
- return alpha !== 0;
977
- }
978
- return true;
979
- };
980
867
  const handleCopiedList = (el, domRange) => {
981
868
  // Ensure you're working with an Element, not a Text node
982
869
  const startEl = domRange.startContainer.nodeType === Node.ELEMENT_NODE ? domRange.startContainer : domRange.startContainer.parentElement;
@@ -996,15 +883,11 @@ const handleCopiedList = (el, domRange) => {
996
883
  el.insertAdjacentText("afterbegin", "- ");
997
884
  }
998
885
  };
999
- const cleanCopiedDOM = container => {
1000
- container.querySelectorAll('[style*="display: none"], [contenteditable="false"]').forEach(el => el.remove());
1001
- return container;
1002
- };
1003
886
  const getCopiedTextFormat = domRange => {
1004
887
  const contents = domRange.cloneContents();
1005
888
  const div = document.createElement("div");
1006
889
  div.appendChild(contents);
1007
- cleanCopiedDOM(div);
890
+
1008
891
  // Replace <br> with newlines
1009
892
  div.querySelectorAll("br").forEach(br => br.replaceWith("\n"));
1010
893
  const BLOCK_TAGS = ["DIV", "P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"];
@@ -1032,7 +915,6 @@ const getCopiedHTMLFormat = domRange => {
1032
915
  const htmlContents = domRange.cloneContents();
1033
916
  const container = document.createElement("div");
1034
917
  container.appendChild(htmlContents);
1035
- cleanCopiedDOM(container);
1036
918
  const html = container.innerHTML;
1037
919
  return html;
1038
920
  };
@@ -1057,5 +939,4 @@ export const handleCopy = (event, editor) => {
1057
939
  event.clipboardData?.setData("text/html", html);
1058
940
  event.clipboardData?.setData("text/plain", text);
1059
941
  event.clipboardData?.setData("application/x-slate-fragment", encodedFragment);
1060
- };
1061
- export const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "blockquote"];
942
+ };
@@ -8,31 +8,27 @@ export const appHeaderNode = ({
8
8
  appLogo: "none",
9
9
  menus: menus || [{
10
10
  type: "menu",
11
- url: "",
12
- placeholder: "home",
11
+ url: "home",
13
12
  target: "",
14
13
  text: "Home",
15
14
  linkType: "page"
16
15
  }, {
17
16
  type: "menu",
18
- url: "",
19
- placeholder: "wireframe2",
17
+ url: "wireframe2",
20
18
  target: "",
21
19
  text: "Wireframe",
22
20
  linkType: "page"
23
21
  }, {
24
22
  type: "menu",
25
- url: "",
23
+ url: "https://www.google.com",
26
24
  target: "",
27
- placeholder: "Work",
28
25
  text: "Work",
29
26
  linkType: "webAddress"
30
27
  }, {
31
28
  type: "menu",
32
- url: "",
29
+ url: "https://www.google.com",
33
30
  target: "",
34
31
  text: "Contact",
35
- placeholder: "Contact",
36
32
  linkType: "webAddress"
37
33
  }],
38
34
  menuStyle: "stacked",
@@ -55,7 +51,7 @@ export const createAppHeaderNode = ({
55
51
  children: [{
56
52
  type: "grid-item",
57
53
  grid: 12,
58
- children: [appHeaderNode({
54
+ children: [...appHeaderNode({
59
55
  menus
60
56
  })],
61
57
  bgColor: "rgba(255, 255, 255, 0)",
@@ -1,5 +1,9 @@
1
- import { insertSlashNode } from "./helper";
1
+ import { Path, Transforms } from "slate";
2
+ import insertNewLine from "./insertNewLine";
3
+ import { getCurrentElementText } from "../plugins/withHTML";
2
4
  export const insertSignature = editor => {
5
+ const hasText = getCurrentElementText(editor);
6
+ const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor.selection.anchor.path;
3
7
  const signature = {
4
8
  type: "signature",
5
9
  alignment: "center",
@@ -13,5 +17,8 @@ export const insertSignature = editor => {
13
17
  text: " "
14
18
  }]
15
19
  };
16
- insertSlashNode(editor, signature);
20
+ Transforms.insertNodes(editor, signature, {
21
+ at: insertPath
22
+ });
23
+ insertNewLine(editor);
17
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.6.4",
3
+ "version": "10.6.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -38,6 +38,7 @@
38
38
  "react-icons": "^4.10.1",
39
39
  "react-katex": "^3.0.1",
40
40
  "react-rnd": "^10.4.11",
41
+ "react-scripts": "5.0.1",
41
42
  "react-signature-canvas": "^1.0.6",
42
43
  "react-slick": "^0.29.0",
43
44
  "sanitize-html": "^2.13.0",
@@ -68,7 +69,7 @@
68
69
  "storybook": "storybook dev -p 6006",
69
70
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
70
71
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
71
- "publish:local": "rm -rf /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/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
73
  "publish:flozy": "./publish-flozy.sh",
73
74
  "publish:flozy2": "./publish-flozy2.sh",
74
75
  "publish:permission": "chmod +x publish-flozy.sh && chmod +x publish-flozy2.sh"
@@ -121,8 +122,7 @@
121
122
  "prop-types": "^15.8.1",
122
123
  "source-map-explorer": "^2.5.3",
123
124
  "storybook": "^7.4.0",
124
- "webpack": "^5.88.2",
125
- "react-scripts": "5.0.1"
125
+ "webpack": "^5.88.2"
126
126
  },
127
127
  "overrides": {
128
128
  "react-refresh": "0.11.0"