@flozy/editor 10.4.4 → 10.4.6

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 (165) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +131 -16
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +46 -8
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/Accordion/Accordion.js +46 -9
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -5
  9. package/dist/Editor/Elements/Button/EditorButton.js +27 -9
  10. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  14. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +27 -26
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -5
  17. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +10 -4
  18. package/dist/Editor/Elements/Embed/Video.js +1 -1
  19. package/dist/Editor/Elements/Form/Form.js +3 -3
  20. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
  21. package/dist/Editor/Elements/Form/FormField.js +3 -2
  22. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  23. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -31
  24. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  26. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  27. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
  28. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  29. package/dist/Editor/Elements/FreeGrid/styles.js +14 -0
  30. package/dist/Editor/Elements/Grid/Grid.js +14 -2
  31. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  32. package/dist/Editor/Elements/Signature/Signature.css +2 -1
  33. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
  34. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
  35. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  36. package/dist/Editor/Elements/Table/DragButton.js +0 -1
  37. package/dist/Editor/Elements/Table/Draggable.js +6 -2
  38. package/dist/Editor/Elements/Table/Styles.js +7 -0
  39. package/dist/Editor/Elements/Table/Table.js +3 -3
  40. package/dist/Editor/Elements/Table/TableCell.js +24 -5
  41. package/dist/Editor/Elements/Title/title.js +6 -6
  42. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  43. package/dist/Editor/MiniEditor.js +2 -1
  44. package/dist/Editor/Styles/EditorStyles.js +5 -5
  45. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  46. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  47. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  48. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  49. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  51. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  52. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  53. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  54. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  55. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
  56. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
  57. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  58. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  59. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  60. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  61. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  62. package/dist/Editor/common/Checkbox/index.js +46 -0
  63. package/dist/Editor/common/Checkbox/styles.js +45 -0
  64. package/dist/Editor/common/ColorPickerButton.js +41 -16
  65. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  66. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  67. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  68. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  69. package/dist/Editor/common/CustomSelect.js +43 -0
  70. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  71. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  72. package/dist/Editor/common/Icon.js +28 -0
  73. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  74. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +45 -65
  76. package/dist/Editor/common/LinkSettings/index.js +14 -28
  77. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  78. package/dist/Editor/common/LinkSettings/style.js +164 -244
  79. package/dist/Editor/common/MentionsPopup/index.js +4 -1
  80. package/dist/Editor/common/RadioGroup/index.js +48 -0
  81. package/dist/Editor/common/RadioGroup/styles.js +29 -0
  82. package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
  83. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  84. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  86. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  87. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  88. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  89. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  90. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  91. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  92. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  93. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  94. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  95. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
  96. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  97. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  98. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  99. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -19
  100. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  101. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +42 -58
  102. package/dist/Editor/common/RnD/VirtualElement/helper.js +323 -132
  103. package/dist/Editor/common/RnD/VirtualElement/styles.js +16 -0
  104. package/dist/Editor/common/RnD/index.js +67 -38
  105. package/dist/Editor/common/Select/index.js +44 -7
  106. package/dist/Editor/common/Select/styles.js +30 -2
  107. package/dist/Editor/common/Shorthands/elements.js +54 -0
  108. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  109. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
  110. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  111. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  112. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  113. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  114. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  115. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  116. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  117. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  118. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  119. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  120. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  121. package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
  122. package/dist/Editor/common/Uploader.js +16 -0
  123. package/dist/Editor/common/iconListV2.js +76 -0
  124. package/dist/Editor/common/iconslist.js +21 -0
  125. package/dist/Editor/commonStyle.js +116 -61
  126. package/dist/Editor/helper/index.js +5 -1
  127. package/dist/Editor/helper/textIndeces.js +58 -0
  128. package/dist/Editor/helper/theme.js +203 -2
  129. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  130. package/dist/Editor/hooks/useMouseMove.js +9 -3
  131. package/dist/Editor/hooks/useTable.js +5 -4
  132. package/dist/Editor/hooks/useThemeValues.js +63 -0
  133. package/dist/Editor/plugins/withEmbeds.js +1 -1
  134. package/dist/Editor/plugins/withHTML.js +3 -1
  135. package/dist/Editor/plugins/withTable.js +1 -1
  136. package/dist/Editor/theme/ThemeList.js +50 -173
  137. package/dist/Editor/theme/index.js +149 -0
  138. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  139. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  140. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  141. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  142. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  143. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  144. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  145. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  146. package/dist/Editor/themeSettings/icons.js +60 -0
  147. package/dist/Editor/themeSettings/index.js +380 -0
  148. package/dist/Editor/themeSettings/style.js +299 -0
  149. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  150. package/dist/Editor/themeSettingsAI/index.js +355 -0
  151. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  152. package/dist/Editor/themeSettingsAI/style.js +332 -0
  153. package/dist/Editor/utils/SlateUtilityFunctions.js +161 -37
  154. package/dist/Editor/utils/accordion.js +14 -4
  155. package/dist/Editor/utils/button.js +1 -17
  156. package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
  157. package/dist/Editor/utils/draftToSlate.js +3 -2
  158. package/dist/Editor/utils/events.js +50 -6
  159. package/dist/Editor/utils/font.js +40 -37
  160. package/dist/Editor/utils/formfield.js +1 -0
  161. package/dist/Editor/utils/helper.js +210 -26
  162. package/dist/Editor/utils/insertAppHeader.js +1 -1
  163. package/dist/Editor/utils/signature.js +2 -9
  164. package/dist/Editor/utils/updateFormName.js +22 -0
  165. package/package.json +4 -4
@@ -0,0 +1,332 @@
1
+ const style = ({
2
+ appTheme: theme
3
+ }) => ({
4
+ ".fs-12": {
5
+ fontSize: "12px"
6
+ },
7
+ ".fs-14": {
8
+ fontSize: "14px"
9
+ },
10
+ ".fw-500": {
11
+ fontWeight: "500"
12
+ },
13
+ ".fw-600": {
14
+ fontWeight: "600"
15
+ },
16
+ ".pointer": {
17
+ cursor: "pointer"
18
+ },
19
+ ".transformNone": {
20
+ textTransform: "none"
21
+ },
22
+ ".settingsContainer": {
23
+ width: "340px",
24
+ padding: "16px 16px",
25
+ background: "#fff",
26
+ ".header": {
27
+ borderBottom: `1px solid #DCE4EC`,
28
+ paddingBottom: "8px"
29
+ // marginBottom: "16px",
30
+ }
31
+ },
32
+
33
+ ".title": {
34
+ fontWeight: "700",
35
+ fontSize: "14px"
36
+ },
37
+ ".closeBtn": {
38
+ width: "26px",
39
+ height: "26px",
40
+ BorderRadius: "4px",
41
+ flexShrik: "0",
42
+ padding: "4px",
43
+ background: " #F8FAFC",
44
+ borderRadius: "4px"
45
+ },
46
+ ".MuiTabs-scroller": {
47
+ borderBottom: `1px solid #DCE4EC`
48
+ },
49
+ ".themeCardWrapper": {
50
+ borderRadius: "4px",
51
+ ".active": {
52
+ background: "#ECF2FF"
53
+ }
54
+ },
55
+ ".primaryCard, .secondaryCard": {
56
+ width: "44px",
57
+ height: "44px",
58
+ borderRadius: "5px",
59
+ border: `1px solid #929292`
60
+ },
61
+ ".flexAlign": {
62
+ display: "flex",
63
+ alignItems: "center",
64
+ flexWrap: "wrap"
65
+ },
66
+ ".flexItem": {
67
+ maxWidth: "50%",
68
+ flex: "1 1 50%" /* allow shrink and grow but cap at 50% */,
69
+ minWidth: 0 /* important for flex children */
70
+ },
71
+
72
+ ".activeColorBox, .xsColorBox": {
73
+ width: "24px",
74
+ height: "24px",
75
+ borderRadius: "5px",
76
+ border: `1px solid #929292`
77
+ },
78
+ ".themeCard": {
79
+ borderRadius: "7px",
80
+ padding: "16px",
81
+ border: "1px solid #F3F3F3",
82
+ boxShadow: "1px 2px 5px 0px #00000014",
83
+ position: "relative",
84
+ flexWrap: "nowrap",
85
+ ".tickIcon": {
86
+ visibility: "hidden",
87
+ opacity: "0",
88
+ position: "absolute",
89
+ right: "-8px",
90
+ top: "-8px"
91
+ },
92
+ "&.selected": {
93
+ ".tickIcon": {
94
+ visibility: "visible",
95
+ opacity: "1"
96
+ }
97
+ }
98
+ },
99
+ ".otherColors": {
100
+ display: "flex",
101
+ flexWrap: "wrap",
102
+ width: "48px",
103
+ ".smallCard": {
104
+ width: "20px",
105
+ height: "20px",
106
+ borderRadius: "5px",
107
+ border: `1px solid #929292`
108
+ }
109
+ },
110
+ ".imageUpload": {
111
+ background: "#F3F3F3",
112
+ borderRadius: "12px",
113
+ padding: "10px",
114
+ height: "208px",
115
+ position: "relative",
116
+ "& .resetIcon": {
117
+ position: "absolute",
118
+ right: "10px",
119
+ top: "10px"
120
+ },
121
+ ".changeImgText": {
122
+ position: "absolute",
123
+ left: "50%",
124
+ top: "50%",
125
+ transform: "translate(-50%, -50%)",
126
+ zIndex: 1,
127
+ background: "#0000004D",
128
+ color: "#fff",
129
+ padding: "6px",
130
+ borderRadius: "6px",
131
+ fontSize: "12px",
132
+ fontWeight: 600,
133
+ opacity: "0",
134
+ visibility: "hidden"
135
+ },
136
+ "&:hover": {
137
+ ".changeImgText": {
138
+ opacity: "1",
139
+ visibility: "visible"
140
+ }
141
+ }
142
+ },
143
+ ".imgUploadInner": {
144
+ background: "#fff",
145
+ borderRadius: "10px",
146
+ border: "0.79px dashed #8360FD",
147
+ height: "100%"
148
+ },
149
+ ".outlineBtn": {
150
+ color: "#2563EB",
151
+ borderRadius: "10px",
152
+ boxShadow: "0px 4px 10px 0px #00000026",
153
+ border: "1px solid #2563EB",
154
+ background: "#EBF1F9",
155
+ height: "34px",
156
+ textTransform: "unset",
157
+ fontWeight: "bold",
158
+ "&:hover": {
159
+ background: "#EBF1F9"
160
+ }
161
+ },
162
+ ".seondaryOutlineBtn": {
163
+ border: "1px solid #D8DDE1",
164
+ borderRadius: "8px",
165
+ // boxShadow: "0px 4px 10px 0px #00000026",
166
+ height: "34px",
167
+ textTransform: "unset",
168
+ background: "#f5f6f9 !important",
169
+ color: "#64748B !important",
170
+ "&:hover": {
171
+ border: "1px solid #D8DDE1",
172
+ background: "#f5f6f9 !important"
173
+ }
174
+ },
175
+ ".blueBtn": {
176
+ boxShadow: "0px 4px 10px 0px #00000026",
177
+ background: "#2563EB",
178
+ borderRadius: "8px",
179
+ textTransform: "unset",
180
+ height: "34px",
181
+ color: "#fff",
182
+ fontWeight: "bold",
183
+ "&.disabled": {
184
+ background: "#D9D9DD !important",
185
+ color: "#fff !important"
186
+ }
187
+ },
188
+ ".generatedItem": {
189
+ border: "1px solid #E4E6E9",
190
+ borderRadius: "7px",
191
+ padding: "14px",
192
+ display: "flex",
193
+ gap: "16px",
194
+ position: "relative",
195
+ justifyContent: "space-between",
196
+ marginBottom: "12px",
197
+ ".tickIcon": {
198
+ visibility: "hidden",
199
+ opacity: "0",
200
+ position: "absolute",
201
+ right: "-8px",
202
+ top: "-8px"
203
+ },
204
+ "&.selected": {
205
+ border: "1px solid #2563EB",
206
+ boxShadow: " 3px 3px 8px 0px #2563EB40",
207
+ ".tickIcon": {
208
+ visibility: "visible",
209
+ opacity: "1"
210
+ }
211
+ },
212
+ ".colorBox": {
213
+ border: "1px solid #929292",
214
+ height: "28px",
215
+ width: "28px",
216
+ borderRadius: "5px"
217
+ }
218
+ },
219
+ ".textArea": {
220
+ background: "#F3F3F3",
221
+ borderRadius: "12px",
222
+ padding: "10px",
223
+ height: "208px",
224
+ "& textarea": {
225
+ width: "100%",
226
+ height: "100% !important",
227
+ border: "0.79px solid #8360FD",
228
+ background: "#FFFFFF",
229
+ borderRadius: "8px",
230
+ padding: "10px"
231
+ }
232
+ },
233
+ ".imageUrl": {
234
+ height: "auto !important",
235
+ ".MuiOutlinedInput-root": {
236
+ border: "0.79px solid #8360FD",
237
+ background: "#FFFFFF",
238
+ borderRadius: "8px",
239
+ ".tickIcon": {
240
+ width: "18px"
241
+ }
242
+ },
243
+ "&.invalidUrl": {
244
+ ".MuiInputAdornment-root": {
245
+ ".tickIcon": {
246
+ ".fillPath": {
247
+ fill: "#D9D9DD!important"
248
+ }
249
+ }
250
+ }
251
+ }
252
+ },
253
+ ".saveThemeContainer": {
254
+ ".MuiOutlinedInput-root": {
255
+ borderRadius: "8px",
256
+ boxShadow: "0px 4px 16px 0px #0000000D"
257
+ }
258
+ },
259
+ ".uploadedImage": {
260
+ width: "126px",
261
+ height: "126px",
262
+ borderRadius: "126px"
263
+ },
264
+ ".MuiDialog-paper": {
265
+ borderRadius: "10px",
266
+ background: theme?.palette?.editor?.miniToolBarBackground
267
+ },
268
+ "& .MuiInputBase-root": {
269
+ borderRadius: "8px",
270
+ background: theme?.palette?.editor?.inputFieldBgColor,
271
+ border: `none`,
272
+ height: "40px",
273
+ boxShadow: "0px 4px 16px 0px #0000000D",
274
+ fontFamily: "Inter, sans-serif",
275
+ "&:hover .MuiOutlinedInput-notchedOutline": {
276
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
277
+ },
278
+ "& input::placeholder": {
279
+ color: "#94A3B8 !important",
280
+ opacity: "unset",
281
+ fontFamily: "Inter, sans-serif"
282
+ },
283
+ "& .colorPickerButton": {
284
+ border: `2px solid ${theme?.palette?.editor?.buttonBorder2} !important`
285
+ }
286
+ },
287
+ "& .MuiInputBase-root:has(.colorPickerButton)": {
288
+ "& .MuiInputBase-input": {
289
+ padding: "8.5px 14px 8.5px 0px",
290
+ fontFamily: "Inter, sans-serif"
291
+ }
292
+ },
293
+ "& .MuiInputBase-input": {
294
+ color: theme?.palette?.editor?.deletePopUpButtonTextColor,
295
+ textTransform: "math-auto",
296
+ fontFamily: "Inter, sans-serif"
297
+ },
298
+ "& .MuiOutlinedInput-notchedOutline": {
299
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
300
+ },
301
+ "& fieldset": {
302
+ border: `1px solid transparent`,
303
+ borderRadius: "8px"
304
+ },
305
+ "& .saveThemeActionBtns": {
306
+ "& button": {
307
+ fontWeight: 600,
308
+ fontSize: "14px",
309
+ opacity: 1,
310
+ borderRadius: "8px",
311
+ textTransform: "math-auto",
312
+ padding: "4px 20px",
313
+ height: "fit-content",
314
+ minWidth: "90px",
315
+ lineHeight: "1.75 !important",
316
+ "@media only screen and (max-width: 899px)": {
317
+ width: "50%"
318
+ },
319
+ "&.confirmBtn": {
320
+ backgroundColor: "#2563EB",
321
+ color: "#ffffff",
322
+ border: `1px solid #2563EB`
323
+ },
324
+ "&.cancelBtn": {
325
+ backgroundColor: theme?.palette?.editor?.closeButtonBackground,
326
+ color: theme?.palette?.editor?.customDialogueCloseBtnColor,
327
+ border: `1px solid ${theme?.palette?.editor?.customDialogueCloseBtnBorder}`
328
+ }
329
+ }
330
+ }
331
+ });
332
+ 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 { getBreakpointLineSpacing, getBreakPointsValue, getDevice, groupByBreakpoint } from "../helper/theme";
37
+ import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, getElementProperty, textThemeFields } 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, getSlateDom } 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
  import { jsxs as _jsxs } from "react/jsx-runtime";
53
53
  const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
@@ -56,7 +56,17 @@ const LIST_FORMAT_TYPE = {
56
56
  orderedList: "list-item",
57
57
  unorderedList: "list-item"
58
58
  };
59
- const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix"];
59
+
60
+ // const NEWLINESAFTER = [
61
+ // "headingOne",
62
+ // "headingTwo",
63
+ // "headingThree",
64
+ // "headingFour",
65
+ // "headingFive",
66
+ // "headingSix",
67
+ // ];
68
+
69
+ const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
60
70
  export const toggleBlock = (editor, format, selection = true, attr = {}) => {
61
71
  const isActive = isBlockActive(editor, format);
62
72
  const isList = list_types.includes(format);
@@ -89,8 +99,9 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
89
99
  if (!selection) {
90
100
  Transforms.insertText(editor, "");
91
101
  }
102
+ const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
92
103
  Transforms.setNodes(editor, {
93
- type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
104
+ type: isActive ? forActiveType : isList ? LIST_FORMAT_TYPE[format] : format,
94
105
  ...attr
95
106
  });
96
107
  if (isList && !isActive) {
@@ -99,10 +110,12 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
99
110
  children: []
100
111
  });
101
112
  }
102
- if (NEWLINESAFTER.indexOf(format) > -1) {
103
- insertNewLine(editor);
104
- }
113
+
114
+ // if (NEWLINESAFTER.indexOf(format) > -1) {
115
+ // insertNewLine(editor);
116
+ // }
105
117
  };
118
+
106
119
  export const addMarkData = (editor, data) => {
107
120
  try {
108
121
  Editor.addMark(editor, data.format, data.value);
@@ -111,9 +124,14 @@ export const addMarkData = (editor, data) => {
111
124
  }
112
125
  };
113
126
  export const toggleMark = (editor, format) => {
114
- const isActive = isMarkActive(editor, format);
127
+ const isActive = isMarkBtnActive(editor, format);
115
128
  if (isActive) {
116
- Editor.removeMark(editor, format);
129
+ const isThemeSupportedMark = textThemeFields.some(f => f === format);
130
+ if (isThemeSupportedMark) {
131
+ Editor.addMark(editor, format, false);
132
+ } else {
133
+ Editor.removeMark(editor, format);
134
+ }
117
135
  } else {
118
136
  Editor.addMark(editor, format, true);
119
137
  }
@@ -127,6 +145,58 @@ export const isMarkActive = (editor, format) => {
127
145
  return null;
128
146
  }
129
147
  };
148
+ export const isMarkBtnActive = (editor, format) => {
149
+ switch (format) {
150
+ case "bold":
151
+ {
152
+ const style = getSelectedElementStyle("font-weight", editor);
153
+ return style === "700";
154
+ }
155
+ case "italic":
156
+ {
157
+ const style = getSelectedElementStyle("font-style", editor);
158
+ return style === format;
159
+ }
160
+ // case "underline": {
161
+ // const style = getSelectedElementStyle("text-decoration");
162
+
163
+ // return style?.includes(format);
164
+ // }
165
+ // case "strikethrough": {
166
+ // const style = getSelectedElementStyle("text-decoration");
167
+
168
+ // return style?.includes("line-through");
169
+ // }
170
+ default:
171
+ return isMarkActive(editor, format);
172
+ }
173
+ };
174
+ export const getSelectedElementStyle = (styleProperty, editor, format) => {
175
+ try {
176
+ if (!editor.selection) {
177
+ return "";
178
+ }
179
+ if (Range.isCollapsed(editor.selection)) {
180
+ return "";
181
+ }
182
+ if (format) {
183
+ const value = activeMark(editor, format, true);
184
+ if (value) {
185
+ return value;
186
+ }
187
+ }
188
+ const domRange = ReactEditor.toDOMRange(editor, editor.selection);
189
+ const selectedDomNode = domRange.commonAncestorContainer;
190
+
191
+ // If it's a text node, get its parent element
192
+ const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
193
+ if (selectedElement) {
194
+ return getElementProperty(selectedElement, styleProperty);
195
+ }
196
+ } catch (err) {
197
+ console.log(err);
198
+ }
199
+ };
130
200
  export const isBlockActive = (editor, format) => {
131
201
  const [match] = Editor.nodes(editor, {
132
202
  match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
@@ -152,7 +222,7 @@ export const upateBlockActive = (editor, format, attr = {}) => {
152
222
  });
153
223
  }
154
224
  };
155
- export const activeMark = (editor, format) => {
225
+ export const activeMark = (editor, format, noDefaultValue) => {
156
226
  const defaultMarkData = {
157
227
  color: "#000000",
158
228
  bgColor: "#FFFFFF",
@@ -162,7 +232,7 @@ export const activeMark = (editor, format) => {
162
232
  };
163
233
  try {
164
234
  const marks = Editor.marks(editor);
165
- let defaultValue = defaultMarkData[format];
235
+ let defaultValue = noDefaultValue ? "" : defaultMarkData[format];
166
236
  const {
167
237
  selection
168
238
  } = editor || {};
@@ -179,6 +249,31 @@ export const activeMark = (editor, format) => {
179
249
  return null;
180
250
  }
181
251
  };
252
+
253
+ // to avoid the styles, that automatically assign from themes
254
+ const getThemeMarkedLeaf = (leaf, children) => {
255
+ const {
256
+ italic,
257
+ bold
258
+ } = leaf || {};
259
+ const style = {};
260
+ if (italic === false) {
261
+ style.fontStyle = "normal";
262
+ }
263
+ if (bold === false) {
264
+ style.fontWeight = "normal";
265
+ }
266
+ if (Object.keys(style).length) {
267
+ children = /*#__PURE__*/_jsx(Box, {
268
+ component: "span",
269
+ sx: {
270
+ "& span": style
271
+ },
272
+ children: children
273
+ });
274
+ }
275
+ return children;
276
+ };
182
277
  export const getMarked = (leaf, children, theme) => {
183
278
  const className = leaf?.doublequote ? "doublequote" : "";
184
279
  const lineH = leaf?.lineHeight;
@@ -208,6 +303,7 @@ export const getMarked = (leaf, children, theme) => {
208
303
  children: children
209
304
  });
210
305
  }
306
+ children = getThemeMarkedLeaf(leaf, children);
211
307
  if (leaf.strikethrough) {
212
308
  children = /*#__PURE__*/_jsx("span", {
213
309
  style: {
@@ -235,6 +331,15 @@ export const getMarked = (leaf, children, theme) => {
235
331
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
236
332
  const family = leaf?.fontFamily;
237
333
  const textStyles = getTextColor(leaf?.color);
334
+ const fontSize = {
335
+ lg: sizeMap[leaf.fontSize] || leaf.fontSize,
336
+ ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
337
+ };
338
+ const fontSizesImportant = {};
339
+ Object.entries(fontSize).forEach(([key, value]) => {
340
+ fontSizesImportant[key] = `${value} !important`;
341
+ });
342
+ const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
238
343
  children = /*#__PURE__*/_jsx("span", {
239
344
  style: {
240
345
  background: leaf.bgColor
@@ -243,12 +348,13 @@ export const getMarked = (leaf, children, theme) => {
243
348
  className: `${className} leaf-item`,
244
349
  component: "span",
245
350
  sx: {
246
- ...groupByBreakpoint({
247
- fontSize: {
248
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
249
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
250
- }
251
- }, theme),
351
+ "& span": {
352
+ // fontSize: fontSizesImportant,
353
+ // ...groupByBreakpoint(fontSizesImportant, theme),
354
+ background: leaf.bgColor,
355
+ ...fontSizeWithBreakpoints
356
+ },
357
+ ...fontSizeWithBreakpoints,
252
358
  // ...wrapThemeBreakpoints(
253
359
  // {
254
360
  // lg: sizeMap[leaf.fontSize] || leaf.fontSize,
@@ -300,15 +406,23 @@ export const getBlock = props => {
300
406
  const {
301
407
  translation
302
408
  } = customProps;
409
+ const commonHeadingProps = () => ({
410
+ ...attributes,
411
+ ...element.attr,
412
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
413
+ });
414
+ const commonParaProps = paraType => ({
415
+ ...attributes,
416
+ ...element.attr,
417
+ className: `edt-paragraphs content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
418
+ });
303
419
  const breakpoint = getDevice(window.innerWidth);
304
420
  const lineH = element?.children[0]?.lineHeight;
305
421
  const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
306
422
  switch (element.type) {
307
423
  case "headingOne":
308
424
  return /*#__PURE__*/_jsxs("h1", {
309
- ...attributes,
310
- ...element.attr,
311
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
425
+ ...commonHeadingProps(),
312
426
  placeholder: translation("Heading 1"),
313
427
  children: [children, /*#__PURE__*/_jsx("span", {
314
428
  contentEditable: false
@@ -316,9 +430,7 @@ export const getBlock = props => {
316
430
  });
317
431
  case "headingTwo":
318
432
  return /*#__PURE__*/_jsxs("h2", {
319
- ...attributes,
320
- ...element.attr,
321
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
433
+ ...commonHeadingProps(),
322
434
  placeholder: translation("Heading 2"),
323
435
  children: [children, /*#__PURE__*/_jsx("span", {
324
436
  contentEditable: false
@@ -326,9 +438,7 @@ export const getBlock = props => {
326
438
  });
327
439
  case "headingThree":
328
440
  return /*#__PURE__*/_jsxs("h3", {
329
- ...attributes,
330
- ...element.attr,
331
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
441
+ ...commonHeadingProps(),
332
442
  placeholder: translation("Heading 3"),
333
443
  children: [children, /*#__PURE__*/_jsx("span", {
334
444
  contentEditable: false
@@ -336,9 +446,7 @@ export const getBlock = props => {
336
446
  });
337
447
  case "headingFour":
338
448
  return /*#__PURE__*/_jsxs("h4", {
339
- ...attributes,
340
- ...element.attr,
341
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
449
+ ...commonHeadingProps(),
342
450
  placeholder: translation("Heading 4"),
343
451
  children: [children, /*#__PURE__*/_jsx("span", {
344
452
  contentEditable: false
@@ -346,9 +454,7 @@ export const getBlock = props => {
346
454
  });
347
455
  case "headingFive":
348
456
  return /*#__PURE__*/_jsxs("h5", {
349
- ...attributes,
350
- ...element.attr,
351
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
457
+ ...commonHeadingProps(),
352
458
  placeholder: translation("Heading 5"),
353
459
  children: [children, /*#__PURE__*/_jsx("span", {
354
460
  contentEditable: false
@@ -356,14 +462,30 @@ export const getBlock = props => {
356
462
  });
357
463
  case "headingSix":
358
464
  return /*#__PURE__*/_jsxs("h6", {
359
- ...attributes,
360
- ...element.attr,
361
- className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
465
+ ...commonHeadingProps(),
362
466
  placeholder: translation("Heading 6"),
363
467
  children: [children, /*#__PURE__*/_jsx("span", {
364
468
  contentEditable: false
365
469
  })]
366
470
  });
471
+ case "paragraphOne":
472
+ return /*#__PURE__*/_jsx("p", {
473
+ ...commonParaProps("para1"),
474
+ placeholder: "Paragraph 1",
475
+ children: children
476
+ });
477
+ case "paragraphTwo":
478
+ return /*#__PURE__*/_jsx("p", {
479
+ ...commonParaProps("para2"),
480
+ placeholder: "Paragraph 2",
481
+ children: children
482
+ });
483
+ case "paragraphThree":
484
+ return /*#__PURE__*/_jsx("p", {
485
+ ...commonParaProps("para3"),
486
+ placeholder: "Paragraph 3",
487
+ children: children
488
+ });
367
489
  case "blockquote":
368
490
  return /*#__PURE__*/_jsx("blockquote", {
369
491
  ...attributes,
@@ -672,8 +794,10 @@ export const getQueryStrings = urlString => {
672
794
  const newUrl = new URL(urlString);
673
795
  var youCode = newUrl.searchParams.get("v");
674
796
  if (!youCode) {
675
- youCode = newUrl.pathname.replace("/", "");
797
+ const parts = newUrl.pathname.split("/");
798
+ youCode = parts[parts.length - 1]; // video ID
676
799
  }
800
+
677
801
  return `https://www.youtube.com/embed/${youCode}`;
678
802
  } else {
679
803
  return urlString;