@flozy/editor 7.0.7 → 7.0.8

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 (129) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +74 -25
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +33 -16
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  7. package/dist/Editor/Elements/Button/EditorButton.js +26 -9
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +57 -12
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  10. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  11. package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
  12. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  15. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  16. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
  17. package/dist/Editor/Elements/Embed/Image.js +2 -2
  18. package/dist/Editor/Elements/Form/Form.js +1 -0
  19. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -14
  20. package/dist/Editor/Elements/FreeGrid/styles.js +4 -0
  21. package/dist/Editor/Elements/Grid/GridItem.js +2 -3
  22. package/dist/Editor/Elements/Link/Link.js +70 -43
  23. package/dist/Editor/Elements/List/CheckList.js +2 -1
  24. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  25. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  26. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  27. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  28. package/dist/Editor/Elements/Table/Table.js +3 -3
  29. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  30. package/dist/Editor/Elements/Title/title.js +13 -1
  31. package/dist/Editor/Elements/Variables/Style.js +28 -2
  32. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  33. package/dist/Editor/MiniEditor.js +4 -2
  34. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  35. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  36. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  37. package/dist/Editor/Toolbar/FormatTools/TextSize.js +7 -15
  38. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +46 -36
  39. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  40. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +211 -91
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +11 -4
  44. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -12
  45. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  46. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +99 -7
  47. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  48. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  49. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  50. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  51. package/dist/Editor/common/ColorPickerButton.js +35 -9
  52. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  53. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  54. package/dist/Editor/common/CustomDialog/index.js +94 -0
  55. package/dist/Editor/common/CustomDialog/style.js +67 -0
  56. package/dist/Editor/common/CustomSelect.js +33 -0
  57. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  58. package/dist/Editor/common/DnD/Draggable.js +0 -1
  59. package/dist/Editor/common/FontLoader/FontList.js +1 -9
  60. package/dist/Editor/common/FontLoader/FontLoader.js +6 -4
  61. package/dist/Editor/common/Icon.js +28 -0
  62. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  63. package/dist/Editor/common/MentionsPopup/Styles.js +3 -9
  64. package/dist/Editor/common/MentionsPopup/index.js +0 -1
  65. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  70. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  74. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  75. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  76. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  77. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
  78. package/dist/Editor/common/RnD/Utils/index.js +40 -0
  79. package/dist/Editor/common/RnD/index.js +23 -3
  80. package/dist/Editor/common/Shorthands/elements.js +54 -0
  81. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  82. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  83. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +35 -11
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  91. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  92. package/dist/Editor/common/Uploader.js +8 -0
  93. package/dist/Editor/commonStyle.js +58 -63
  94. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  95. package/dist/Editor/helper/index.js +2 -2
  96. package/dist/Editor/helper/theme.js +224 -3
  97. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  98. package/dist/Editor/hooks/useMouseMove.js +13 -5
  99. package/dist/Editor/plugins/withEmbeds.js +1 -1
  100. package/dist/Editor/plugins/withHTML.js +4 -2
  101. package/dist/Editor/plugins/withLayout.js +1 -1
  102. package/dist/Editor/plugins/withTable.js +1 -1
  103. package/dist/Editor/theme/ThemeList.js +50 -173
  104. package/dist/Editor/theme/index.js +144 -0
  105. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  106. package/dist/Editor/themeSettings/buttons/index.js +283 -0
  107. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  108. package/dist/Editor/themeSettings/colorTheme/index.js +292 -0
  109. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  110. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  111. package/dist/Editor/themeSettings/fonts/index.js +220 -0
  112. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  113. package/dist/Editor/themeSettings/icons.js +60 -0
  114. package/dist/Editor/themeSettings/index.js +320 -0
  115. package/dist/Editor/themeSettings/style.js +152 -0
  116. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  117. package/dist/Editor/themeSettingsAI/index.js +356 -0
  118. package/dist/Editor/themeSettingsAI/saveTheme.js +197 -0
  119. package/dist/Editor/themeSettingsAI/style.js +250 -0
  120. package/dist/Editor/utils/SlateUtilityFunctions.js +161 -42
  121. package/dist/Editor/utils/button.js +0 -14
  122. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  123. package/dist/Editor/utils/draftToSlate.js +3 -2
  124. package/dist/Editor/utils/font.js +40 -37
  125. package/dist/Editor/utils/helper.js +88 -19
  126. package/dist/Editor/utils/link.js +1 -1
  127. package/dist/Editor/utils/pageSettings.js +14 -2
  128. package/dist/Editor/utils/table.js +21 -0
  129. 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,15 +232,39 @@ 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) {
174
263
  children = /*#__PURE__*/_jsx("span", {
175
264
  style: {
176
- color: "inherit"
265
+ color: "inherit",
266
+ background: "var(--slate-highlight-bg)"
177
267
  },
178
- className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
179
- ,
180
268
  children: children
181
269
  });
182
270
  }
@@ -195,6 +283,7 @@ export const getMarked = (leaf, children, theme) => {
195
283
  children: children
196
284
  });
197
285
  }
286
+ children = getThemeMarkedLeaf(leaf, children);
198
287
  if (leaf.strikethrough) {
199
288
  children = /*#__PURE__*/_jsx("span", {
200
289
  style: {
@@ -222,20 +311,27 @@ export const getMarked = (leaf, children, theme) => {
222
311
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
223
312
  const family = leaf?.fontFamily;
224
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);
225
323
  children = /*#__PURE__*/_jsx("span", {
226
- style: {
227
- background: leaf.bgColor
228
- },
229
324
  children: /*#__PURE__*/_jsx(Box, {
230
325
  className: className,
231
326
  component: "span",
232
327
  sx: {
233
- ...groupByBreakpoint({
234
- fontSize: {
235
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
236
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
237
- }
238
- }, theme),
328
+ "& span": {
329
+ // fontSize: fontSizesImportant,
330
+ // ...groupByBreakpoint(fontSizesImportant, theme),
331
+ background: leaf.bgColor,
332
+ ...fontSizeWithBreakpoints
333
+ },
334
+ ...fontSizeWithBreakpoints,
239
335
  // ...wrapThemeBreakpoints(
240
336
  // {
241
337
  // lg: sizeMap[leaf.fontSize] || leaf.fontSize,
@@ -277,55 +373,71 @@ export const getBlock = props => {
277
373
  } = props;
278
374
  const attributes = props.attributes ?? {};
279
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
+ });
280
386
  switch (element.type) {
281
387
  case "headingOne":
282
388
  return /*#__PURE__*/_jsx("h1", {
283
- ...attributes,
284
- ...element.attr,
285
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
389
+ ...commonHeadingProps(),
286
390
  placeholder: "Heading 1",
287
391
  children: children
288
392
  });
289
393
  case "headingTwo":
290
394
  return /*#__PURE__*/_jsx("h2", {
291
- ...attributes,
292
- ...element.attr,
293
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
395
+ ...commonHeadingProps(),
294
396
  placeholder: "Heading 2",
295
397
  children: children
296
398
  });
297
399
  case "headingThree":
298
400
  return /*#__PURE__*/_jsx("h3", {
299
- ...attributes,
300
- ...element.attr,
301
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
401
+ ...commonHeadingProps(),
302
402
  placeholder: "Heading 3",
303
403
  children: children
304
404
  });
305
405
  case "headingFour":
306
406
  return /*#__PURE__*/_jsx("h4", {
307
- ...attributes,
308
- ...element.attr,
309
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
407
+ ...commonHeadingProps(),
310
408
  placeholder: "Heading 4",
311
409
  children: children
312
410
  });
313
411
  case "headingFive":
314
412
  return /*#__PURE__*/_jsx("h5", {
315
- ...attributes,
316
- ...element.attr,
317
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
413
+ ...commonHeadingProps(),
318
414
  placeholder: "Heading 5",
319
415
  children: children
320
416
  });
321
417
  case "headingSix":
322
418
  return /*#__PURE__*/_jsx("h6", {
323
- ...attributes,
324
- ...element.attr,
325
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
419
+ ...commonHeadingProps(),
326
420
  placeholder: "Heading 6",
327
421
  children: children
328
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
+ });
329
441
  case "blockquote":
330
442
  return /*#__PURE__*/_jsx("blockquote", {
331
443
  ...attributes,
@@ -338,7 +450,8 @@ export const getBlock = props => {
338
450
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
339
451
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
340
452
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
341
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
453
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
454
+ lineHeight: 1.43
342
455
  },
343
456
  children: children
344
457
  });
@@ -398,6 +511,9 @@ export const getBlock = props => {
398
511
  });
399
512
  case "orderedList":
400
513
  return /*#__PURE__*/_jsx("ol", {
514
+ style: {
515
+ lineHeight: 1.43
516
+ },
401
517
  className: "listItemMargin",
402
518
  type: "1",
403
519
  ...attributes,
@@ -405,6 +521,9 @@ export const getBlock = props => {
405
521
  });
406
522
  case "unorderedList":
407
523
  return /*#__PURE__*/_jsx("ul", {
524
+ style: {
525
+ lineHeight: 1.43
526
+ },
408
527
  className: "listItemMargin",
409
528
  ...attributes,
410
529
  children: children
@@ -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);
@@ -43,7 +43,8 @@ const useTableResize = ({
43
43
  minWidth
44
44
  } = minMaxProps || {};
45
45
  setSize(currentSize => {
46
- const calcWidth = currentSize?.width + e.movementX;
46
+ const width = currentSize?.width || parentDOM?.clientWidth;
47
+ const calcWidth = width + e.movementX;
47
48
  return {
48
49
  width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
49
50
  height: currentSize.height + e.movementY,
@@ -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
  }]