@flozy/editor 6.0.1 → 6.0.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 (110) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +79 -21
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +21 -16
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  6. package/dist/Editor/Elements/Button/EditorButton.js +25 -9
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +57 -12
  8. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  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 +0 -14
  14. package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
  15. package/dist/Editor/Elements/Grid/GridItem.js +2 -3
  16. package/dist/Editor/Elements/Link/Link.js +70 -43
  17. package/dist/Editor/Elements/SimpleText/index.js +7 -12
  18. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  19. package/dist/Editor/Elements/Title/title.js +13 -1
  20. package/dist/Editor/Elements/Variables/Style.js +28 -2
  21. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  22. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  23. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  24. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  25. package/dist/Editor/Toolbar/FormatTools/TextSize.js +7 -15
  26. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +9 -8
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +210 -90
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  30. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
  31. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -9
  32. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  33. package/dist/Editor/Toolbar/PopupTool/index.js +29 -37
  34. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  35. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  36. package/dist/Editor/common/ColorPickerButton.js +32 -9
  37. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  38. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  39. package/dist/Editor/common/CustomDialog/index.js +94 -0
  40. package/dist/Editor/common/CustomDialog/style.js +67 -0
  41. package/dist/Editor/common/CustomSelect.js +33 -0
  42. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  43. package/dist/Editor/common/DnD/Draggable.js +0 -1
  44. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  45. package/dist/Editor/common/FontLoader/FontLoader.js +74 -42
  46. package/dist/Editor/common/Icon.js +28 -0
  47. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  48. package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -2
  49. package/dist/Editor/common/MentionsPopup/Styles.js +3 -9
  50. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  51. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  52. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  53. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  54. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  55. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  56. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  57. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  58. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  59. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  60. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
  61. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  62. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  63. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
  64. package/dist/Editor/common/RnD/Utils/index.js +40 -0
  65. package/dist/Editor/common/RnD/index.js +23 -3
  66. package/dist/Editor/common/Section/index.js +60 -89
  67. package/dist/Editor/common/Shorthands/elements.js +54 -0
  68. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  69. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  70. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  71. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  72. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  73. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +35 -11
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  76. package/dist/Editor/common/Uploader.js +8 -0
  77. package/dist/Editor/commonStyle.js +55 -65
  78. package/dist/Editor/helper/index.js +2 -2
  79. package/dist/Editor/helper/theme.js +200 -2
  80. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  81. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  82. package/dist/Editor/hooks/useMouseMove.js +9 -3
  83. package/dist/Editor/plugins/withEmbeds.js +1 -1
  84. package/dist/Editor/plugins/withHTML.js +2 -2
  85. package/dist/Editor/plugins/withLayout.js +1 -1
  86. package/dist/Editor/plugins/withTable.js +1 -1
  87. package/dist/Editor/theme/ThemeList.js +50 -173
  88. package/dist/Editor/theme/index.js +144 -0
  89. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  90. package/dist/Editor/themeSettings/buttons/index.js +283 -0
  91. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  92. package/dist/Editor/themeSettings/colorTheme/index.js +292 -0
  93. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  94. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  95. package/dist/Editor/themeSettings/fonts/index.js +220 -0
  96. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  97. package/dist/Editor/themeSettings/icons.js +60 -0
  98. package/dist/Editor/themeSettings/index.js +320 -0
  99. package/dist/Editor/themeSettings/style.js +152 -0
  100. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  101. package/dist/Editor/themeSettingsAI/index.js +356 -0
  102. package/dist/Editor/themeSettingsAI/saveTheme.js +197 -0
  103. package/dist/Editor/themeSettingsAI/style.js +250 -0
  104. package/dist/Editor/utils/SlateUtilityFunctions.js +156 -38
  105. package/dist/Editor/utils/button.js +0 -14
  106. package/dist/Editor/utils/draftToSlate.js +3 -2
  107. package/dist/Editor/utils/font.js +40 -37
  108. package/dist/Editor/utils/helper.js +48 -20
  109. package/dist/Editor/utils/link.js +1 -1
  110. package/package.json +5 -2
@@ -0,0 +1,250 @@
1
+ const style = () => ({
2
+ ".fs-12": {
3
+ fontSize: "12px"
4
+ },
5
+ ".fs-14": {
6
+ fontSize: "14px"
7
+ },
8
+ ".fw-500": {
9
+ fontWeight: "500"
10
+ },
11
+ ".fw-600": {
12
+ fontWeight: "600"
13
+ },
14
+ ".pointer": {
15
+ cursor: "pointer"
16
+ },
17
+ ".transformNone": {
18
+ textTransform: "none"
19
+ },
20
+ ".settingsContainer": {
21
+ width: "340px",
22
+ padding: "16px 16px",
23
+ background: "#fff",
24
+ ".header": {
25
+ borderBottom: `1px solid #DCE4EC`,
26
+ paddingBottom: "8px"
27
+ // marginBottom: "16px",
28
+ }
29
+ },
30
+
31
+ ".title": {
32
+ fontWeight: "700",
33
+ fontSize: "14px"
34
+ },
35
+ ".closeBtn": {
36
+ width: "26px",
37
+ height: "26px",
38
+ BorderRadius: "4px",
39
+ flexShrik: "0",
40
+ padding: "4px",
41
+ background: " #F8FAFC",
42
+ borderRadius: "4px"
43
+ },
44
+ ".MuiTabs-scroller": {
45
+ borderBottom: `1px solid #DCE4EC`
46
+ },
47
+ ".themeCardWrapper": {
48
+ borderRadius: "4px",
49
+ ".active": {
50
+ background: "#ECF2FF"
51
+ }
52
+ },
53
+ ".primaryCard, .secondaryCard": {
54
+ width: "44px",
55
+ height: "44px",
56
+ borderRadius: "5px",
57
+ border: `1px solid #929292`
58
+ },
59
+ ".flexAlign": {
60
+ display: "flex",
61
+ alignItems: "center"
62
+ },
63
+ ".activeColorBox, .xsColorBox": {
64
+ width: "24px",
65
+ height: "24px",
66
+ borderRadius: "5px",
67
+ border: `1px solid #929292`
68
+ },
69
+ ".themeCard": {
70
+ borderRadius: "7px",
71
+ padding: "16px",
72
+ border: "1px solid #F3F3F3",
73
+ boxShadow: "1px 2px 5px 0px #00000014",
74
+ position: "relative",
75
+ flexWrap: "nowrap",
76
+ ".tickIcon": {
77
+ visibility: "hidden",
78
+ opacity: "0",
79
+ position: "absolute",
80
+ right: "-8px",
81
+ top: "-8px"
82
+ },
83
+ "&.selected": {
84
+ ".tickIcon": {
85
+ visibility: "visible",
86
+ opacity: "1"
87
+ }
88
+ }
89
+ },
90
+ ".otherColors": {
91
+ display: "flex",
92
+ flexWrap: "wrap",
93
+ width: "48px",
94
+ ".smallCard": {
95
+ width: "20px",
96
+ height: "20px",
97
+ borderRadius: "5px",
98
+ border: `1px solid #929292`
99
+ }
100
+ },
101
+ ".imageUpload": {
102
+ background: "#F3F3F3",
103
+ borderRadius: "12px",
104
+ padding: "10px",
105
+ height: "208px",
106
+ position: "relative",
107
+ "& .resetIcon": {
108
+ position: "absolute",
109
+ right: "10px",
110
+ top: "10px"
111
+ },
112
+ ".changeImgText": {
113
+ position: "absolute",
114
+ left: "50%",
115
+ top: "50%",
116
+ transform: "translate(-50%, -50%)",
117
+ zIndex: 1,
118
+ background: "#0000004D",
119
+ color: "#fff",
120
+ padding: "6px",
121
+ borderRadius: "6px",
122
+ fontSize: "12px",
123
+ fontWeight: 600,
124
+ opacity: "0",
125
+ visibility: "hidden"
126
+ },
127
+ "&:hover": {
128
+ ".changeImgText": {
129
+ opacity: "1",
130
+ visibility: "visible"
131
+ }
132
+ }
133
+ },
134
+ ".imgUploadInner": {
135
+ background: "#fff",
136
+ borderRadius: "10px",
137
+ border: "0.79px dashed #8360FD",
138
+ height: "100%"
139
+ },
140
+ ".outlineBtn": {
141
+ color: "#2563EB",
142
+ borderRadius: "8px",
143
+ boxShadow: "0px 4px 10px 0px #00000026",
144
+ border: "1px solid #2563EB",
145
+ background: "#EBF1F9",
146
+ height: "34px",
147
+ textTransform: "unset"
148
+ },
149
+ ".seondaryOutlineBtn": {
150
+ border: "1px solid #D8DDE1",
151
+ borderRadius: "8px",
152
+ // boxShadow: "0px 4px 10px 0px #00000026",
153
+ height: "34px",
154
+ textTransform: "unset",
155
+ background: "#eceef3",
156
+ color: "#64748B"
157
+ },
158
+ ".blueBtn": {
159
+ boxShadow: "0px 4px 10px 0px #00000026",
160
+ background: "#2563EB",
161
+ borderRadius: "8px",
162
+ textTransform: "unset",
163
+ height: "34px",
164
+ color: "#fff",
165
+ "&.disabled": {
166
+ background: "#D9D9DD !important",
167
+ color: "#fff !important"
168
+ }
169
+ },
170
+ ".generatedItem": {
171
+ border: "1px solid #E4E6E9",
172
+ borderRadius: "7px",
173
+ padding: "14px",
174
+ display: "flex",
175
+ gap: "16px",
176
+ position: "relative",
177
+ justifyContent: "space-between",
178
+ marginBottom: "12px",
179
+ ".tickIcon": {
180
+ visibility: "hidden",
181
+ opacity: "0",
182
+ position: "absolute",
183
+ right: "-8px",
184
+ top: "-8px"
185
+ },
186
+ "&.selected": {
187
+ border: "1px solid #2563EB",
188
+ boxShadow: " 3px 3px 8px 0px #2563EB40",
189
+ ".tickIcon": {
190
+ visibility: "visible",
191
+ opacity: "1"
192
+ }
193
+ },
194
+ ".colorBox": {
195
+ border: "1px solid #929292",
196
+ height: "28px",
197
+ width: "28px",
198
+ borderRadius: "5px"
199
+ }
200
+ },
201
+ ".textArea": {
202
+ background: "#F3F3F3",
203
+ borderRadius: "12px",
204
+ padding: "10px",
205
+ height: "208px",
206
+ "& textarea": {
207
+ width: "100%",
208
+ height: "100% !important",
209
+ border: "0.79px solid #8360FD",
210
+ background: "#FFFFFF",
211
+ borderRadius: "8px",
212
+ padding: "10px"
213
+ }
214
+ },
215
+ ".imageUrl": {
216
+ height: "auto !important",
217
+ ".MuiOutlinedInput-root": {
218
+ border: "0.79px solid #8360FD",
219
+ background: "#FFFFFF",
220
+ borderRadius: "8px",
221
+ ".tickIcon": {
222
+ width: "18px"
223
+ }
224
+ },
225
+ "&.invalidUrl": {
226
+ ".MuiInputAdornment-root": {
227
+ ".tickIcon": {
228
+ ".fillPath": {
229
+ fill: "#D9D9DD!important"
230
+ }
231
+ }
232
+ }
233
+ }
234
+ },
235
+ ".saveThemeContainer": {
236
+ ".MuiOutlinedInput-root": {
237
+ borderRadius: "8px",
238
+ boxShadow: "0px 4px 16px 0px #0000000D"
239
+ }
240
+ },
241
+ ".uploadedImage": {
242
+ width: "126px",
243
+ height: "126px",
244
+ borderRadius: "126px"
245
+ },
246
+ ".MuiDialog-paper": {
247
+ borderRadius: "10px"
248
+ }
249
+ });
250
+ export default style;
@@ -1,4 +1,4 @@
1
- import { Editor, Transforms, Element as SlateElement } from "slate";
1
+ import { Editor, Transforms, Element as SlateElement, Range } 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, groupByBreakpoint } from "../helper/theme";
37
+ import { getBreakPointsValue, textThemeFields, getElementProperty } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
39
- import insertNewLine from "./insertNewLine";
40
39
  import Divider from "../Elements/Divider/Divider";
41
40
  import { getBorderColor } from "./helper";
42
41
  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,7 +55,17 @@ const LIST_FORMAT_TYPE = {
55
55
  orderedList: "list-item",
56
56
  unorderedList: "list-item"
57
57
  };
58
- const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
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"];
59
69
  export const toggleBlock = (editor, format, selection = true, attr = {}) => {
60
70
  const isActive = isBlockActive(editor, format);
61
71
  const isList = list_types.includes(format);
@@ -88,8 +98,9 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
88
98
  if (!selection) {
89
99
  Transforms.insertText(editor, "");
90
100
  }
101
+ const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
91
102
  Transforms.setNodes(editor, {
92
- type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
103
+ type: isActive ? forActiveType : isList ? LIST_FORMAT_TYPE[format] : format,
93
104
  ...attr
94
105
  });
95
106
  if (isList && !isActive) {
@@ -98,10 +109,12 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
98
109
  children: []
99
110
  });
100
111
  }
101
- if (NEWLINESAFTER.indexOf(format) > -1) {
102
- insertNewLine(editor);
103
- }
112
+
113
+ // if (NEWLINESAFTER.indexOf(format) > -1) {
114
+ // insertNewLine(editor);
115
+ // }
104
116
  };
117
+
105
118
  export const addMarkData = (editor, data) => {
106
119
  try {
107
120
  Editor.addMark(editor, data.format, data.value);
@@ -110,9 +123,14 @@ export const addMarkData = (editor, data) => {
110
123
  }
111
124
  };
112
125
  export const toggleMark = (editor, format) => {
113
- const isActive = isMarkActive(editor, format);
126
+ const isActive = isMarkBtnActive(editor, format);
114
127
  if (isActive) {
115
- Editor.removeMark(editor, format);
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
+ }
116
134
  } else {
117
135
  Editor.addMark(editor, format, true);
118
136
  }
@@ -126,6 +144,52 @@ export const isMarkActive = (editor, format) => {
126
144
  return null;
127
145
  }
128
146
  };
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
+ };
129
193
  export const isBlockActive = (editor, format) => {
130
194
  const [match] = Editor.nodes(editor, {
131
195
  match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
@@ -168,6 +232,31 @@ export const activeMark = (editor, format) => {
168
232
  return null;
169
233
  }
170
234
  };
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
+ };
171
260
  export const getMarked = (leaf, children, theme) => {
172
261
  const className = leaf?.doublequote ? "doublequote" : "";
173
262
  if (leaf.highlight) {
@@ -194,6 +283,7 @@ export const getMarked = (leaf, children, theme) => {
194
283
  children: children
195
284
  });
196
285
  }
286
+ children = getThemeMarkedLeaf(leaf, children);
197
287
  if (leaf.strikethrough) {
198
288
  children = /*#__PURE__*/_jsx("span", {
199
289
  style: {
@@ -221,20 +311,27 @@ export const getMarked = (leaf, children, theme) => {
221
311
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
222
312
  const family = leaf?.fontFamily;
223
313
  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);
224
323
  children = /*#__PURE__*/_jsx("span", {
225
- style: {
226
- background: leaf.bgColor
227
- },
228
324
  children: /*#__PURE__*/_jsx(Box, {
229
325
  className: className,
230
326
  component: "span",
231
327
  sx: {
232
- ...groupByBreakpoint({
233
- fontSize: {
234
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
235
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
236
- }
237
- }, theme),
328
+ "& span": {
329
+ // fontSize: fontSizesImportant,
330
+ // ...groupByBreakpoint(fontSizesImportant, theme),
331
+ background: leaf.bgColor,
332
+ ...fontSizeWithBreakpoints
333
+ },
334
+ ...fontSizeWithBreakpoints,
238
335
  // ...wrapThemeBreakpoints(
239
336
  // {
240
337
  // lg: sizeMap[leaf.fontSize] || leaf.fontSize,
@@ -276,55 +373,71 @@ export const getBlock = props => {
276
373
  } = props;
277
374
  const attributes = props.attributes ?? {};
278
375
  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
+ });
279
386
  switch (element.type) {
280
387
  case "headingOne":
281
388
  return /*#__PURE__*/_jsx("h1", {
282
- ...attributes,
283
- ...element.attr,
284
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
389
+ ...commonHeadingProps(),
285
390
  placeholder: "Heading 1",
286
391
  children: children
287
392
  });
288
393
  case "headingTwo":
289
394
  return /*#__PURE__*/_jsx("h2", {
290
- ...attributes,
291
- ...element.attr,
292
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
395
+ ...commonHeadingProps(),
293
396
  placeholder: "Heading 2",
294
397
  children: children
295
398
  });
296
399
  case "headingThree":
297
400
  return /*#__PURE__*/_jsx("h3", {
298
- ...attributes,
299
- ...element.attr,
300
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
401
+ ...commonHeadingProps(),
301
402
  placeholder: "Heading 3",
302
403
  children: children
303
404
  });
304
405
  case "headingFour":
305
406
  return /*#__PURE__*/_jsx("h4", {
306
- ...attributes,
307
- ...element.attr,
308
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
407
+ ...commonHeadingProps(),
309
408
  placeholder: "Heading 4",
310
409
  children: children
311
410
  });
312
411
  case "headingFive":
313
412
  return /*#__PURE__*/_jsx("h5", {
314
- ...attributes,
315
- ...element.attr,
316
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
413
+ ...commonHeadingProps(),
317
414
  placeholder: "Heading 5",
318
415
  children: children
319
416
  });
320
417
  case "headingSix":
321
418
  return /*#__PURE__*/_jsx("h6", {
322
- ...attributes,
323
- ...element.attr,
324
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
419
+ ...commonHeadingProps(),
325
420
  placeholder: "Heading 6",
326
421
  children: children
327
422
  });
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
+ });
328
441
  case "blockquote":
329
442
  return /*#__PURE__*/_jsx("blockquote", {
330
443
  ...attributes,
@@ -620,6 +733,11 @@ export const getBlock = props => {
620
733
  children: children
621
734
  });
622
735
  default:
736
+ // return (
737
+ // <span {...attributes} {...element.attr}>
738
+ // {children}
739
+ // </span>
740
+ // );
623
741
  return /*#__PURE__*/_jsx(SimpleText, {
624
742
  ...props,
625
743
  isEmpty: isEmpty
@@ -11,20 +11,6 @@ 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
- },
28
14
  ...(windowVar.lastButtonProps || {})
29
15
  };
30
16
  Transforms.insertNodes(editor, button);
@@ -82,7 +82,8 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
82
82
  };
83
83
  export const draftToSlate = props => {
84
84
  const {
85
- data
85
+ data,
86
+ needLayout
86
87
  } = props;
87
88
  if (data?.blocks && data?.blocks?.length > 0) {
88
89
  const converted = data?.blocks?.reduce((a, b) => {
@@ -104,7 +105,7 @@ export const draftToSlate = props => {
104
105
  return data;
105
106
  } else {
106
107
  return [{
107
- type: "paragraph",
108
+ type: needLayout ? "title" : "paragraph",
108
109
  children: [{
109
110
  text: ""
110
111
  }]