@flozy/editor 11.1.1 → 11.1.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.
- package/dist/Editor/ChatEditor.js +6 -6
- package/dist/Editor/CommonEditor.js +82 -21
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +37 -4
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
- package/dist/Editor/Elements/Attachments/Attachments.js +154 -11
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
- package/dist/Editor/Elements/Button/EditorButton.js +22 -7
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +134 -55
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +7 -8
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +8 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +1 -1
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +5 -0
- package/dist/Editor/Elements/Embed/Embed.js +37 -43
- package/dist/Editor/Elements/Embed/Image.js +242 -22
- package/dist/Editor/Elements/Embed/Video.js +277 -32
- package/dist/Editor/Elements/Form/Form.js +10 -35
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +34 -75
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +9 -5
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -1
- package/dist/Editor/Elements/FreeGrid/helper.js +194 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +15 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -3
- package/dist/Editor/Elements/Signature/SignaturePopup.js +2 -13
- package/dist/Editor/Elements/SimpleText/index.js +4 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +10 -3
- package/dist/Editor/Elements/Title/title.js +4 -5
- package/dist/Editor/Elements/TopBanner/TopBanner.js +4 -2
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +5 -3
- package/dist/Editor/Styles/EditorStyles.js +16 -5
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +33 -29
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +25 -23
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +15 -5
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +65 -7
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +66 -12
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -4
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/BackIcon.js +18 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
- package/dist/Editor/common/ColorPickerButton.js +38 -19
- package/dist/Editor/common/CustomColorPicker/index.js +130 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog2/index.js +94 -0
- package/dist/Editor/common/CustomDialog2/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +43 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +1 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +45 -7
- package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
- package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -11
- package/dist/Editor/common/RnD/Utils/index.js +3 -1
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +52 -63
- package/dist/Editor/common/RnD/VirtualElement/helper.js +248 -68
- package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
- package/dist/Editor/common/RnD/index.js +61 -14
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +18 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +15 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/formStyle.js +19 -13
- package/dist/Editor/common/StyleBuilder/index.js +8 -4
- package/dist/Editor/common/Uploader.js +118 -17
- package/dist/Editor/common/UploaderWithProgress.js +183 -0
- package/dist/Editor/common/iconslist.js +21 -0
- package/dist/Editor/commonStyle.js +37 -3
- package/dist/Editor/helper/index.js +4 -1
- package/dist/Editor/helper/theme.js +203 -2
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +12 -3
- package/dist/Editor/hooks/useTable.js +62 -1
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +56 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +70 -0
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
- package/dist/Editor/themeSettings/buttons/index.js +300 -0
- package/dist/Editor/themeSettings/buttons/style.js +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +240 -0
- package/dist/Editor/themeSettings/fonts/style.js +62 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +380 -0
- package/dist/Editor/themeSettings/style.js +299 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +355 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
- package/dist/Editor/themeSettingsAI/style.js +332 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +162 -38
- package/dist/Editor/utils/accordion.js +1 -1
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +76 -3
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +1 -1
@@ -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,
|
37
|
+
import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, 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, 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
|
-
|
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
|
-
|
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 ?
|
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
|
-
|
102
|
-
|
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 =
|
126
|
+
const isActive = isMarkBtnActive(editor, format);
|
114
127
|
if (isActive) {
|
115
|
-
|
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,58 @@ 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, format) => {
|
174
|
+
try {
|
175
|
+
if (!editor.selection) {
|
176
|
+
return "";
|
177
|
+
}
|
178
|
+
if (Range.isCollapsed(editor.selection)) {
|
179
|
+
return "";
|
180
|
+
}
|
181
|
+
if (format) {
|
182
|
+
const value = activeMark(editor, format, true);
|
183
|
+
if (value) {
|
184
|
+
return value;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
188
|
+
const selectedDomNode = domRange.commonAncestorContainer;
|
189
|
+
|
190
|
+
// If it's a text node, get its parent element
|
191
|
+
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
192
|
+
if (selectedElement) {
|
193
|
+
return getElementProperty(selectedElement, styleProperty);
|
194
|
+
}
|
195
|
+
} catch (err) {
|
196
|
+
console.log(err);
|
197
|
+
}
|
198
|
+
};
|
129
199
|
export const isBlockActive = (editor, format) => {
|
130
200
|
const [match] = Editor.nodes(editor, {
|
131
201
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
@@ -151,7 +221,7 @@ export const upateBlockActive = (editor, format, attr = {}) => {
|
|
151
221
|
});
|
152
222
|
}
|
153
223
|
};
|
154
|
-
export const activeMark = (editor, format) => {
|
224
|
+
export const activeMark = (editor, format, noDefaultValue) => {
|
155
225
|
const defaultMarkData = {
|
156
226
|
color: "#000000",
|
157
227
|
bgColor: "#FFFFFF",
|
@@ -161,7 +231,7 @@ export const activeMark = (editor, format) => {
|
|
161
231
|
};
|
162
232
|
try {
|
163
233
|
const marks = Editor.marks(editor);
|
164
|
-
let defaultValue = defaultMarkData[format];
|
234
|
+
let defaultValue = noDefaultValue ? "" : defaultMarkData[format];
|
165
235
|
const {
|
166
236
|
selection
|
167
237
|
} = editor || {};
|
@@ -178,6 +248,31 @@ export const activeMark = (editor, format) => {
|
|
178
248
|
return null;
|
179
249
|
}
|
180
250
|
};
|
251
|
+
|
252
|
+
// to avoid the styles, that automatically assign from themes
|
253
|
+
const getThemeMarkedLeaf = (leaf, children) => {
|
254
|
+
const {
|
255
|
+
italic,
|
256
|
+
bold
|
257
|
+
} = leaf || {};
|
258
|
+
const style = {};
|
259
|
+
if (italic === false) {
|
260
|
+
style.fontStyle = "normal";
|
261
|
+
}
|
262
|
+
if (bold === false) {
|
263
|
+
style.fontWeight = "normal";
|
264
|
+
}
|
265
|
+
if (Object.keys(style).length) {
|
266
|
+
children = /*#__PURE__*/_jsx(Box, {
|
267
|
+
component: "span",
|
268
|
+
sx: {
|
269
|
+
"& span": style
|
270
|
+
},
|
271
|
+
children: children
|
272
|
+
});
|
273
|
+
}
|
274
|
+
return children;
|
275
|
+
};
|
181
276
|
export const getMarked = (leaf, children, theme) => {
|
182
277
|
const className = leaf?.doublequote ? "doublequote" : "";
|
183
278
|
const lineH = leaf?.lineHeight;
|
@@ -207,6 +302,7 @@ export const getMarked = (leaf, children, theme) => {
|
|
207
302
|
children: children
|
208
303
|
});
|
209
304
|
}
|
305
|
+
children = getThemeMarkedLeaf(leaf, children);
|
210
306
|
if (leaf.strikethrough) {
|
211
307
|
children = /*#__PURE__*/_jsx("span", {
|
212
308
|
style: {
|
@@ -234,6 +330,15 @@ export const getMarked = (leaf, children, theme) => {
|
|
234
330
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
|
235
331
|
const family = leaf?.fontFamily;
|
236
332
|
const textStyles = getTextColor(leaf?.color);
|
333
|
+
const fontSize = {
|
334
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
335
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
336
|
+
};
|
337
|
+
const fontSizesImportant = {};
|
338
|
+
Object.entries(fontSize).forEach(([key, value]) => {
|
339
|
+
fontSizesImportant[key] = `${value} !important`;
|
340
|
+
});
|
341
|
+
const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
|
237
342
|
children = /*#__PURE__*/_jsx("span", {
|
238
343
|
style: {
|
239
344
|
background: leaf.bgColor
|
@@ -242,12 +347,13 @@ export const getMarked = (leaf, children, theme) => {
|
|
242
347
|
className: `${className} leaf-item`,
|
243
348
|
component: "span",
|
244
349
|
sx: {
|
245
|
-
|
246
|
-
fontSize:
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
},
|
350
|
+
"& span": {
|
351
|
+
// fontSize: fontSizesImportant,
|
352
|
+
// ...groupByBreakpoint(fontSizesImportant, theme),
|
353
|
+
background: leaf.bgColor,
|
354
|
+
...fontSizeWithBreakpoints
|
355
|
+
},
|
356
|
+
...fontSizeWithBreakpoints,
|
251
357
|
// ...wrapThemeBreakpoints(
|
252
358
|
// {
|
253
359
|
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
@@ -268,7 +374,8 @@ export const getMarked = (leaf, children, theme) => {
|
|
268
374
|
WebkitTextFillColor: "unset !important"
|
269
375
|
},
|
270
376
|
style: {
|
271
|
-
"--fontSize_xs": leaf?.fontSize?.xs || "auto"
|
377
|
+
"--fontSize_xs": leaf?.fontSize?.xs || "auto",
|
378
|
+
"--fontSize_lg": leaf?.fontSize?.lg || "auto"
|
272
379
|
},
|
273
380
|
children: children
|
274
381
|
})
|
@@ -299,58 +406,74 @@ export const getBlock = props => {
|
|
299
406
|
const {
|
300
407
|
translation
|
301
408
|
} = customProps;
|
409
|
+
const commonHeadingProps = () => ({
|
410
|
+
...attributes,
|
411
|
+
...element.attr,
|
412
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element disablePointerEvent`
|
413
|
+
});
|
414
|
+
const commonParaProps = paraType => ({
|
415
|
+
...attributes,
|
416
|
+
...element.attr,
|
417
|
+
className: `edt-paragraphs content-editable ${isEmpty ? "empty" : ""} theme-element disablePointerEvent ${paraType}`
|
418
|
+
});
|
302
419
|
const breakpoint = getDevice(window.innerWidth);
|
303
420
|
const lineH = element?.children[0]?.lineHeight;
|
304
421
|
const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
305
422
|
switch (element.type) {
|
306
423
|
case "headingOne":
|
307
424
|
return /*#__PURE__*/_jsx("h1", {
|
308
|
-
...
|
309
|
-
...element.attr,
|
310
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
425
|
+
...commonHeadingProps(),
|
311
426
|
placeholder: translation("Heading 1"),
|
312
427
|
children: children
|
313
428
|
});
|
314
429
|
case "headingTwo":
|
315
430
|
return /*#__PURE__*/_jsx("h2", {
|
316
|
-
...
|
317
|
-
...element.attr,
|
318
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
431
|
+
...commonHeadingProps(),
|
319
432
|
placeholder: translation("Heading 2"),
|
320
433
|
children: children
|
321
434
|
});
|
322
435
|
case "headingThree":
|
323
436
|
return /*#__PURE__*/_jsx("h3", {
|
324
|
-
...
|
325
|
-
...element.attr,
|
326
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
437
|
+
...commonHeadingProps(),
|
327
438
|
placeholder: translation("Heading 3"),
|
328
439
|
children: children
|
329
440
|
});
|
330
441
|
case "headingFour":
|
331
442
|
return /*#__PURE__*/_jsx("h4", {
|
332
|
-
...
|
333
|
-
...element.attr,
|
334
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
443
|
+
...commonHeadingProps(),
|
335
444
|
placeholder: translation("Heading 4"),
|
336
445
|
children: children
|
337
446
|
});
|
338
447
|
case "headingFive":
|
339
448
|
return /*#__PURE__*/_jsx("h5", {
|
340
|
-
...
|
341
|
-
...element.attr,
|
342
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
449
|
+
...commonHeadingProps(),
|
343
450
|
placeholder: translation("Heading 5"),
|
344
451
|
children: children
|
345
452
|
});
|
346
453
|
case "headingSix":
|
347
454
|
return /*#__PURE__*/_jsx("h6", {
|
348
|
-
...
|
349
|
-
...element.attr,
|
350
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} disablePointerEvent`,
|
455
|
+
...commonHeadingProps(),
|
351
456
|
placeholder: translation("Heading 6"),
|
352
457
|
children: children
|
353
458
|
});
|
459
|
+
case "paragraphOne":
|
460
|
+
return /*#__PURE__*/_jsx("p", {
|
461
|
+
...commonParaProps("para1"),
|
462
|
+
placeholder: "Paragraph 1",
|
463
|
+
children: children
|
464
|
+
});
|
465
|
+
case "paragraphTwo":
|
466
|
+
return /*#__PURE__*/_jsx("p", {
|
467
|
+
...commonParaProps("para2"),
|
468
|
+
placeholder: "Paragraph 2",
|
469
|
+
children: children
|
470
|
+
});
|
471
|
+
case "paragraphThree":
|
472
|
+
return /*#__PURE__*/_jsx("p", {
|
473
|
+
...commonParaProps("para3"),
|
474
|
+
placeholder: "Paragraph 3",
|
475
|
+
children: children
|
476
|
+
});
|
354
477
|
case "blockquote":
|
355
478
|
return /*#__PURE__*/_jsx("blockquote", {
|
356
479
|
...attributes,
|
@@ -585,7 +708,8 @@ export const getBlock = props => {
|
|
585
708
|
case "docs":
|
586
709
|
case "pdf":
|
587
710
|
case "xls":
|
588
|
-
case "
|
711
|
+
case "doc":
|
712
|
+
case "ppt":
|
589
713
|
return /*#__PURE__*/_jsx(Attachments, {
|
590
714
|
...props
|
591
715
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Editor,
|
1
|
+
import { Editor, Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
3
|
import { ALLOWED_TEXT_NODES, getNode, getNodeText, getNodeWithType, getSelectedText } from "./helper";
|
4
4
|
import { isMobileWindow } from "../helper";
|