@flozy/editor 7.0.9 → 8.0.1

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 (120) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +106 -33
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +32 -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/Layouts/TableStyles.js +15 -0
  12. package/dist/Editor/Elements/DataView/Layouts/TableView.js +111 -29
  13. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
  14. package/dist/Editor/Elements/DataView/styles.js +8 -8
  15. package/dist/Editor/Elements/Embed/Image.js +2 -2
  16. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -14
  17. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -1
  18. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +2 -1
  19. package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
  20. package/dist/Editor/Elements/Grid/GridItem.js +2 -3
  21. package/dist/Editor/Elements/Link/Link.js +70 -43
  22. package/dist/Editor/Elements/SimpleText/index.js +7 -12
  23. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  24. package/dist/Editor/Elements/Table/Table.js +12 -12
  25. package/dist/Editor/Elements/Title/title.js +13 -1
  26. package/dist/Editor/Elements/Variables/Style.js +28 -2
  27. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  28. package/dist/Editor/Styles/EditorStyles.js +287 -291
  29. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  30. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  31. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  32. package/dist/Editor/Toolbar/FormatTools/TextSize.js +7 -15
  33. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +9 -8
  34. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  35. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +210 -85
  36. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  37. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
  38. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -9
  39. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  40. package/dist/Editor/Toolbar/PopupTool/index.js +31 -38
  41. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  42. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  43. package/dist/Editor/common/ColorPickerButton.js +35 -9
  44. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  45. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  46. package/dist/Editor/common/CustomDialog/index.js +90 -0
  47. package/dist/Editor/common/CustomDialog/style.js +67 -0
  48. package/dist/Editor/common/CustomDialog/styles.js +80 -0
  49. package/dist/Editor/common/CustomSelect.js +33 -0
  50. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  51. package/dist/Editor/common/DnD/Draggable.js +0 -1
  52. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  53. package/dist/Editor/common/FontLoader/FontLoader.js +74 -42
  54. package/dist/Editor/common/Icon.js +28 -0
  55. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  56. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  57. package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -2
  58. package/dist/Editor/common/MentionsPopup/Styles.js +6 -12
  59. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  64. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  68. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  69. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
  70. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  71. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  72. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
  73. package/dist/Editor/common/RnD/Utils/index.js +45 -0
  74. package/dist/Editor/common/RnD/index.js +23 -3
  75. package/dist/Editor/common/Section/index.js +60 -89
  76. package/dist/Editor/common/Shorthands/elements.js +54 -0
  77. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  78. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  79. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  80. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  81. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  82. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +35 -11
  83. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  85. package/dist/Editor/common/Uploader.js +8 -0
  86. package/dist/Editor/commonStyle.js +55 -65
  87. package/dist/Editor/helper/deserialize/index.js +1 -1
  88. package/dist/Editor/helper/index.js +2 -2
  89. package/dist/Editor/helper/theme.js +200 -2
  90. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  91. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  92. package/dist/Editor/hooks/useMouseMove.js +9 -3
  93. package/dist/Editor/plugins/withEmbeds.js +1 -1
  94. package/dist/Editor/plugins/withHTML.js +5 -9
  95. package/dist/Editor/plugins/withLayout.js +1 -1
  96. package/dist/Editor/plugins/withTable.js +1 -1
  97. package/dist/Editor/theme/ThemeList.js +50 -173
  98. package/dist/Editor/theme/index.js +144 -0
  99. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  100. package/dist/Editor/themeSettings/buttons/index.js +283 -0
  101. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  102. package/dist/Editor/themeSettings/colorTheme/index.js +292 -0
  103. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  104. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  105. package/dist/Editor/themeSettings/fonts/index.js +220 -0
  106. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  107. package/dist/Editor/themeSettings/icons.js +60 -0
  108. package/dist/Editor/themeSettings/index.js +320 -0
  109. package/dist/Editor/themeSettings/style.js +152 -0
  110. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  111. package/dist/Editor/themeSettingsAI/index.js +356 -0
  112. package/dist/Editor/themeSettingsAI/saveTheme.js +197 -0
  113. package/dist/Editor/themeSettingsAI/style.js +250 -0
  114. package/dist/Editor/utils/SlateUtilityFunctions.js +157 -49
  115. package/dist/Editor/utils/button.js +0 -14
  116. package/dist/Editor/utils/draftToSlate.js +3 -2
  117. package/dist/Editor/utils/font.js +40 -37
  118. package/dist/Editor/utils/helper.js +59 -19
  119. package/dist/Editor/utils/link.js +1 -1
  120. 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;
@@ -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
- import { getBorderColor, getSlateDom } from "./helper";
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
@@ -161,23 +225,38 @@ export const activeMark = (editor, format) => {
161
225
  };
162
226
  try {
163
227
  const marks = Editor.marks(editor);
164
- let defaultValue = defaultMarkData[format];
165
- const {
166
- selection
167
- } = editor || {};
168
- if (format === "fontSize" && selection && !Range.isCollapsed(selection)) {
169
- const slateDom = getSlateDom(editor, editor?.selection);
170
- if (slateDom) {
171
- const parentElement = slateDom.commonAncestorContainer.parentElement;
172
- defaultValue = window.getComputedStyle(parentElement).fontSize;
173
- }
174
- }
228
+ const defaultValue = defaultMarkData[format];
175
229
  return marks?.[format] ?? defaultValue;
176
230
  } catch (err) {
177
231
  console.log(err);
178
232
  return null;
179
233
  }
180
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
+ };
181
260
  export const getMarked = (leaf, children, theme) => {
182
261
  const className = leaf?.doublequote ? "doublequote" : "";
183
262
  if (leaf.highlight) {
@@ -204,6 +283,7 @@ export const getMarked = (leaf, children, theme) => {
204
283
  children: children
205
284
  });
206
285
  }
286
+ children = getThemeMarkedLeaf(leaf, children);
207
287
  if (leaf.strikethrough) {
208
288
  children = /*#__PURE__*/_jsx("span", {
209
289
  style: {
@@ -231,20 +311,27 @@ export const getMarked = (leaf, children, theme) => {
231
311
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
232
312
  const family = leaf?.fontFamily;
233
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);
234
323
  children = /*#__PURE__*/_jsx("span", {
235
- style: {
236
- background: leaf.bgColor
237
- },
238
324
  children: /*#__PURE__*/_jsx(Box, {
239
325
  className: className,
240
326
  component: "span",
241
327
  sx: {
242
- ...groupByBreakpoint({
243
- fontSize: {
244
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
245
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
246
- }
247
- }, theme),
328
+ "& span": {
329
+ // fontSize: fontSizesImportant,
330
+ // ...groupByBreakpoint(fontSizesImportant, theme),
331
+ background: leaf.bgColor,
332
+ ...fontSizeWithBreakpoints
333
+ },
334
+ ...fontSizeWithBreakpoints,
248
335
  // ...wrapThemeBreakpoints(
249
336
  // {
250
337
  // lg: sizeMap[leaf.fontSize] || leaf.fontSize,
@@ -286,55 +373,71 @@ export const getBlock = props => {
286
373
  } = props;
287
374
  const attributes = props.attributes ?? {};
288
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
+ });
289
386
  switch (element.type) {
290
387
  case "headingOne":
291
388
  return /*#__PURE__*/_jsx("h1", {
292
- ...attributes,
293
- ...element.attr,
294
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
389
+ ...commonHeadingProps(),
295
390
  placeholder: "Heading 1",
296
391
  children: children
297
392
  });
298
393
  case "headingTwo":
299
394
  return /*#__PURE__*/_jsx("h2", {
300
- ...attributes,
301
- ...element.attr,
302
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
395
+ ...commonHeadingProps(),
303
396
  placeholder: "Heading 2",
304
397
  children: children
305
398
  });
306
399
  case "headingThree":
307
400
  return /*#__PURE__*/_jsx("h3", {
308
- ...attributes,
309
- ...element.attr,
310
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
401
+ ...commonHeadingProps(),
311
402
  placeholder: "Heading 3",
312
403
  children: children
313
404
  });
314
405
  case "headingFour":
315
406
  return /*#__PURE__*/_jsx("h4", {
316
- ...attributes,
317
- ...element.attr,
318
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
407
+ ...commonHeadingProps(),
319
408
  placeholder: "Heading 4",
320
409
  children: children
321
410
  });
322
411
  case "headingFive":
323
412
  return /*#__PURE__*/_jsx("h5", {
324
- ...attributes,
325
- ...element.attr,
326
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
413
+ ...commonHeadingProps(),
327
414
  placeholder: "Heading 5",
328
415
  children: children
329
416
  });
330
417
  case "headingSix":
331
418
  return /*#__PURE__*/_jsx("h6", {
332
- ...attributes,
333
- ...element.attr,
334
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
419
+ ...commonHeadingProps(),
335
420
  placeholder: "Heading 6",
336
421
  children: children
337
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
+ });
338
441
  case "blockquote":
339
442
  return /*#__PURE__*/_jsx("blockquote", {
340
443
  ...attributes,
@@ -630,6 +733,11 @@ export const getBlock = props => {
630
733
  children: children
631
734
  });
632
735
  default:
736
+ // return (
737
+ // <span {...attributes} {...element.attr}>
738
+ // {children}
739
+ // </span>
740
+ // );
633
741
  return /*#__PURE__*/_jsx(SimpleText, {
634
742
  ...props,
635
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
  }]