@flozy/editor 11.2.2 → 11.2.4
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 +7 -7
- package/dist/Editor/CommonEditor.js +86 -24
- 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 +239 -11
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +11 -4
- 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.js +37 -43
- package/dist/Editor/Elements/Embed/Image.js +307 -26
- package/dist/Editor/Elements/Embed/Video.js +355 -35
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +9 -6
- package/dist/Editor/Elements/EmbedScript/styles.js +17 -1
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +25 -22
- package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +37 -76
- 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/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 +19 -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 +6 -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 +66 -13
- package/dist/Editor/common/ImageSelector/Options/ChooseAssets.js +1 -1
- package/dist/Editor/common/ImageSelector/Options/RecentUploads.js +483 -0
- 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 +55 -3
- 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 +13 -3
- 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 +16 -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 +111 -53
- 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/fileTracking.js +22 -0
- package/dist/Editor/service/fileupload.js +77 -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 +165 -40
- package/dist/Editor/utils/accordion.js +1 -1
- package/dist/Editor/utils/attachments.js +138 -2
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/formfield.js +2 -2
- package/dist/Editor/utils/helper.js +101 -3
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +1 -1
|
@@ -15,10 +15,11 @@ const createAttachmentsNode = ({
|
|
|
15
15
|
}]
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export const insertAttachments = (editor, data) => {
|
|
18
|
+
export const insertAttachments = async (editor, data, customProps = null) => {
|
|
19
19
|
try {
|
|
20
20
|
const {
|
|
21
|
-
url
|
|
21
|
+
url,
|
|
22
|
+
source
|
|
22
23
|
} = data;
|
|
23
24
|
const docType = url?.split(".").pop();
|
|
24
25
|
if (url) {
|
|
@@ -28,8 +29,143 @@ export const insertAttachments = (editor, data) => {
|
|
|
28
29
|
});
|
|
29
30
|
Transforms.insertNodes(editor, [attachmentsNode]);
|
|
30
31
|
insertNewLine(editor);
|
|
32
|
+
|
|
33
|
+
// Track document URL if customProps is provided and source is not "recent"
|
|
34
|
+
// Check both direct source property and nested data structure
|
|
35
|
+
const isFromRecentUploads = source === "recent" || data?.source === "recent";
|
|
36
|
+
if (customProps && url && typeof url === "string" && !isFromRecentUploads) {
|
|
37
|
+
try {
|
|
38
|
+
const fileExtension = url.split('.').pop()?.toLowerCase();
|
|
39
|
+
const mimeType = getMimeTypeFromExtension(fileExtension);
|
|
40
|
+
const trackingData = {
|
|
41
|
+
file_url: url,
|
|
42
|
+
name: url.split('/').pop() || 'Document URL',
|
|
43
|
+
mime_type: mimeType,
|
|
44
|
+
resource_type: "flozy_editor",
|
|
45
|
+
resource_id: customProps?.page_id,
|
|
46
|
+
agency_id: customProps?.agency_id,
|
|
47
|
+
uploaded_by: customProps?.user_id,
|
|
48
|
+
category: "editor_url",
|
|
49
|
+
status: 1,
|
|
50
|
+
created_on: new Date().toISOString()
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Try main app service first, fallback to direct implementation
|
|
54
|
+
if (customProps.services && typeof customProps.services === 'function') {
|
|
55
|
+
try {
|
|
56
|
+
const result = await customProps.services('trackEditorUploads', {
|
|
57
|
+
fileData: trackingData,
|
|
58
|
+
category: 'document'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Check if the service call was successful
|
|
62
|
+
if (result && !result.error) {
|
|
63
|
+
console.log("Document URL tracked successfully via main app service:", url);
|
|
64
|
+
} else {
|
|
65
|
+
console.warn('Main app service returned error, falling back to direct tracking:', result);
|
|
66
|
+
const {
|
|
67
|
+
trackFileUpload
|
|
68
|
+
} = await import("../service/fileTracking");
|
|
69
|
+
await trackFileUpload(trackingData, customProps, 'document');
|
|
70
|
+
console.log("Document URL tracked successfully via fallback:", url);
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.warn('Main app service failed, falling back to direct tracking:', error);
|
|
74
|
+
const {
|
|
75
|
+
trackFileUpload
|
|
76
|
+
} = await import("../service/fileTracking");
|
|
77
|
+
await trackFileUpload(trackingData, customProps, 'document');
|
|
78
|
+
console.log("Document URL tracked successfully via fallback:", url);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
const {
|
|
82
|
+
trackFileUpload
|
|
83
|
+
} = await import("../service/fileTracking");
|
|
84
|
+
await trackFileUpload(trackingData, customProps, 'document');
|
|
85
|
+
console.log("Document URL tracked successfully:", url);
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error("Failed to track document URL:", error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
31
91
|
}
|
|
32
92
|
} catch (err) {
|
|
33
93
|
console.log(err);
|
|
34
94
|
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Helper function to get MIME type from file extension
|
|
98
|
+
const getMimeTypeFromExtension = extension => {
|
|
99
|
+
const mimeTypes = {
|
|
100
|
+
'pdf': 'application/pdf',
|
|
101
|
+
'doc': 'application/msword',
|
|
102
|
+
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
103
|
+
'xls': 'application/vnd.ms-excel',
|
|
104
|
+
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
105
|
+
'ppt': 'application/vnd.ms-powerpoint',
|
|
106
|
+
'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
107
|
+
'txt': 'text/plain',
|
|
108
|
+
'csv': 'text/csv',
|
|
109
|
+
'rtf': 'application/rtf',
|
|
110
|
+
'pages': 'application/vnd.apple.pages',
|
|
111
|
+
'numbers': 'application/vnd.apple.numbers',
|
|
112
|
+
'key': 'application/vnd.apple.keynote'
|
|
113
|
+
};
|
|
114
|
+
return mimeTypes[extension] || 'application/octet-stream';
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Helper function to get image MIME type from file extension
|
|
118
|
+
export const getImageMimeTypeFromExtension = extension => {
|
|
119
|
+
const imageMimeTypes = {
|
|
120
|
+
'jpg': 'image/jpeg',
|
|
121
|
+
'jpeg': 'image/jpeg',
|
|
122
|
+
'png': 'image/png',
|
|
123
|
+
'gif': 'image/gif',
|
|
124
|
+
'webp': 'image/webp',
|
|
125
|
+
'svg': 'image/svg+xml',
|
|
126
|
+
'bmp': 'image/bmp',
|
|
127
|
+
'ico': 'image/x-icon',
|
|
128
|
+
'tiff': 'image/tiff',
|
|
129
|
+
'tif': 'image/tiff'
|
|
130
|
+
};
|
|
131
|
+
return imageMimeTypes[extension] || 'image/jpeg'; // Default to jpeg if unknown
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Helper function to get video MIME type from file extension
|
|
135
|
+
export const getVideoMimeTypeFromExtension = extension => {
|
|
136
|
+
const videoMimeTypes = {
|
|
137
|
+
'mp4': 'video/mp4',
|
|
138
|
+
'avi': 'video/x-msvideo',
|
|
139
|
+
'mov': 'video/quicktime',
|
|
140
|
+
'wmv': 'video/x-ms-wmv',
|
|
141
|
+
'flv': 'video/x-flv',
|
|
142
|
+
'webm': 'video/webm',
|
|
143
|
+
'mkv': 'video/x-matroska',
|
|
144
|
+
'm4v': 'video/x-m4v',
|
|
145
|
+
'3gp': 'video/3gpp',
|
|
146
|
+
'ogv': 'video/ogg'
|
|
147
|
+
};
|
|
148
|
+
return videoMimeTypes[extension] || 'video/mp4'; // Default to mp4 if unknown
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Helper function to extract filename and extension from URL
|
|
152
|
+
export const extractFileInfoFromUrl = url => {
|
|
153
|
+
try {
|
|
154
|
+
const urlObj = new URL(url);
|
|
155
|
+
const pathname = urlObj.pathname;
|
|
156
|
+
const filename = pathname.split('/').pop() || 'Unknown File';
|
|
157
|
+
const extension = filename.split('.').pop()?.toLowerCase() || '';
|
|
158
|
+
return {
|
|
159
|
+
filename: decodeURIComponent(filename),
|
|
160
|
+
extension
|
|
161
|
+
};
|
|
162
|
+
} catch (error) {
|
|
163
|
+
// Fallback for invalid URLs
|
|
164
|
+
const filename = url.split('/').pop() || 'Unknown File';
|
|
165
|
+
const extension = filename.split('.').pop()?.toLowerCase() || '';
|
|
166
|
+
return {
|
|
167
|
+
filename: decodeURIComponent(filename),
|
|
168
|
+
extension
|
|
169
|
+
};
|
|
170
|
+
}
|
|
35
171
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Path, Transforms } from "slate";
|
|
2
2
|
import insertNewLine from "./insertNewLine";
|
|
3
|
-
import { windowVar } from "./helper";
|
|
4
3
|
import { getCurrentElementText } from "../plugins/withHTML";
|
|
5
4
|
export const insertButton = editor => {
|
|
6
5
|
const button = {
|
|
@@ -11,22 +10,7 @@ export const insertButton = editor => {
|
|
|
11
10
|
buttonLink: {
|
|
12
11
|
linkType: "webAddress"
|
|
13
12
|
},
|
|
14
|
-
iconPosition: "start"
|
|
15
|
-
bgColor: "#2563EB",
|
|
16
|
-
textColor: "#FFF",
|
|
17
|
-
borderRadius: {
|
|
18
|
-
topLeft: 30,
|
|
19
|
-
topRight: 30,
|
|
20
|
-
bottomLeft: 30,
|
|
21
|
-
bottomRight: 30
|
|
22
|
-
},
|
|
23
|
-
bannerSpacing: {
|
|
24
|
-
left: 16,
|
|
25
|
-
top: 8,
|
|
26
|
-
right: 16,
|
|
27
|
-
bottom: 8
|
|
28
|
-
},
|
|
29
|
-
...(windowVar.lastButtonProps || {})
|
|
13
|
+
iconPosition: "start"
|
|
30
14
|
};
|
|
31
15
|
const hasText = getCurrentElementText(editor);
|
|
32
16
|
const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor?.selection.focus.path;
|
|
@@ -7,43 +7,43 @@ export const sizeMap = {
|
|
|
7
7
|
export const fontFamilyMap = {
|
|
8
8
|
PoppinsRegular: "PoppinsRegular",
|
|
9
9
|
PoppinsBold: "PoppinsBold",
|
|
10
|
-
sans:
|
|
11
|
-
serif:
|
|
12
|
-
monospace:
|
|
13
|
-
roboto: "
|
|
14
|
-
qwitcher: "
|
|
15
|
-
garamond: "
|
|
16
|
-
anton: "
|
|
17
|
-
dmserif: "
|
|
18
|
-
inter: "
|
|
19
|
-
libre: "
|
|
20
|
-
montserrat: "
|
|
21
|
-
opensans: "
|
|
22
|
-
publicsans: "
|
|
23
|
-
raleway: "
|
|
24
|
-
spacemono: "
|
|
25
|
-
bulgarian: "
|
|
26
|
-
impact: "
|
|
27
|
-
redacted: "
|
|
28
|
-
greatVibes: "
|
|
29
|
-
zeyada: "
|
|
30
|
-
allura: "
|
|
31
|
-
pinyon: "
|
|
32
|
-
muellerhoff: "
|
|
33
|
-
dawning: "
|
|
10
|
+
sans: 'Helvetica, Arial, "sans serif"',
|
|
11
|
+
serif: 'Georgia, "Times New Roaman", serif',
|
|
12
|
+
monospace: 'Monaco, "Courier New", monospace',
|
|
13
|
+
roboto: "Roboto, sans-serif",
|
|
14
|
+
qwitcher: '"Qwitcher Grypen", cursive',
|
|
15
|
+
garamond: '"EB Garamond", serif',
|
|
16
|
+
anton: "Anton, sans-serif",
|
|
17
|
+
dmserif: '"DM Serif Text", serif',
|
|
18
|
+
inter: "Inter, sans-serif",
|
|
19
|
+
libre: '"Libre Baskerville", serif',
|
|
20
|
+
montserrat: "Montserrat, sans-serif",
|
|
21
|
+
opensans: '"Open Sans", sans-serif',
|
|
22
|
+
publicsans: '"Public Sans", sans-serif',
|
|
23
|
+
raleway: "Raleway, sans-serif",
|
|
24
|
+
spacemono: '"Space Mono", sans-serif',
|
|
25
|
+
bulgarian: '"Bulgarian Garamond", monospace',
|
|
26
|
+
impact: "Impact, serif",
|
|
27
|
+
redacted: '"Redacted Script", cursive',
|
|
28
|
+
greatVibes: '"Great Vibes", cursive',
|
|
29
|
+
zeyada: "Zeyada, cursive",
|
|
30
|
+
allura: "Allura, cursive",
|
|
31
|
+
pinyon: '"Pinyon Script", cursive',
|
|
32
|
+
muellerhoff: '"Herr Von Muellerhoff", cursive',
|
|
33
|
+
dawning: '"Dawning of a New Day", cursive',
|
|
34
34
|
// New Font Added for Type Signature
|
|
35
|
-
comingsoon: "
|
|
36
|
-
dancingScript: "
|
|
37
|
-
engagement: "
|
|
38
|
-
gaegu: "
|
|
39
|
-
ingridDarling: "
|
|
40
|
-
kitaOne: "
|
|
41
|
-
laBelleAurore: "
|
|
42
|
-
lobster: "
|
|
43
|
-
meaCulpa: "
|
|
44
|
-
meddon: "
|
|
45
|
-
merriWeather: "
|
|
46
|
-
theGirlNextDoor: "
|
|
35
|
+
comingsoon: '"Coming Soon", cursive',
|
|
36
|
+
dancingScript: '"Dancing Script", cursive',
|
|
37
|
+
engagement: "Engagement, cursive",
|
|
38
|
+
gaegu: "Gaegu, cursive",
|
|
39
|
+
ingridDarling: '"Ingrid Darling", cursive',
|
|
40
|
+
kitaOne: "Times",
|
|
41
|
+
laBelleAurore: '"La Belle Aurore", cursive',
|
|
42
|
+
lobster: "Lobster, cursive",
|
|
43
|
+
meaCulpa: '"Mea Culpa", cursive',
|
|
44
|
+
meddon: "Meddon, cursive",
|
|
45
|
+
merriWeather: "Merriweather, serif",
|
|
46
|
+
theGirlNextDoor: '"The Girl Next Door", cursive'
|
|
47
47
|
};
|
|
48
48
|
export const fontOptions = Object.keys(fontFamilyMap).map(m => {
|
|
49
49
|
return {
|
|
@@ -62,7 +62,10 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
|
62
62
|
export const headingMap = {
|
|
63
63
|
headingOne: "32px",
|
|
64
64
|
headingTwo: "24px",
|
|
65
|
-
headingThree: "19px"
|
|
65
|
+
headingThree: "19px",
|
|
66
|
+
headingFour: "16px",
|
|
67
|
+
headingFive: "13px",
|
|
68
|
+
headingSix: "11px"
|
|
66
69
|
};
|
|
67
70
|
export const fontWeightOptions = [{
|
|
68
71
|
text: "Bold",
|
|
@@ -13,8 +13,8 @@ export const formField = data => {
|
|
|
13
13
|
text: ""
|
|
14
14
|
}],
|
|
15
15
|
field_type: "text",
|
|
16
|
-
bgColor: data?.bgColor ? data?.bgColor : "
|
|
17
|
-
borderColor: data?.borderColor ? data?.borderColor : "
|
|
16
|
+
bgColor: data?.bgColor ? data?.bgColor : "",
|
|
17
|
+
borderColor: data?.borderColor ? data?.borderColor : "",
|
|
18
18
|
bannerSpacing: {
|
|
19
19
|
left: 16,
|
|
20
20
|
right: 16,
|
|
@@ -2,7 +2,9 @@ import { Editor, Node, Transforms, Element, Path, Range, Text } from "slate";
|
|
|
2
2
|
import { ReactEditor } from "slate-react";
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { getDevice } from "../helper/theme";
|
|
5
|
+
import { activeMark, getSelectedElementStyle } from "./SlateUtilityFunctions";
|
|
5
6
|
import { getCurrentElementText } from "../plugins/withHTML";
|
|
7
|
+
import { isEmptyTextNode } from "../helper";
|
|
6
8
|
export const windowVar = {};
|
|
7
9
|
let ST_TIMEOUT = null;
|
|
8
10
|
const BLOCKS = ["grid", "dataView"];
|
|
@@ -173,7 +175,7 @@ export const handleInsertLastElement = (event, editor) => {
|
|
|
173
175
|
if (isFreeGrid) {
|
|
174
176
|
return;
|
|
175
177
|
}
|
|
176
|
-
const isLastElementEmpty = lastElement &&
|
|
178
|
+
const isLastElementEmpty = isEmptyTextNode(lastElement) && !lastElement.children?.some(c => BLOCKS.includes(c.type));
|
|
177
179
|
if (!ReactEditor.isFocused(editor)) {
|
|
178
180
|
if (isLastElementEmpty) {
|
|
179
181
|
if (hasPath) {
|
|
@@ -492,6 +494,34 @@ export const decodeString = str => {
|
|
|
492
494
|
console.log(err);
|
|
493
495
|
}
|
|
494
496
|
};
|
|
497
|
+
export const getContrastColor = color => {
|
|
498
|
+
let r, g, b;
|
|
499
|
+
|
|
500
|
+
// Check if the color is in hex format
|
|
501
|
+
if (color.startsWith("#")) {
|
|
502
|
+
r = parseInt(color.substring(1, 3), 16);
|
|
503
|
+
g = parseInt(color.substring(3, 5), 16);
|
|
504
|
+
b = parseInt(color.substring(5, 7), 16);
|
|
505
|
+
}
|
|
506
|
+
// Check if the color is in RGB/RGBA format
|
|
507
|
+
else if (color.startsWith("rgb")) {
|
|
508
|
+
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
|
509
|
+
.split(","); // Split the values into an array
|
|
510
|
+
|
|
511
|
+
r = parseInt(rgbValues[0]);
|
|
512
|
+
g = parseInt(rgbValues[1]);
|
|
513
|
+
b = parseInt(rgbValues[2]);
|
|
514
|
+
} else {
|
|
515
|
+
// If the format is not recognized, default to black text
|
|
516
|
+
return "#000000";
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Calculate relative luminance
|
|
520
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
521
|
+
|
|
522
|
+
// Return black for light colors, white for dark colors
|
|
523
|
+
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
|
524
|
+
};
|
|
495
525
|
export const onDeleteKey = (event, {
|
|
496
526
|
editor
|
|
497
527
|
}) => {
|
|
@@ -829,7 +859,8 @@ export const clearWindowSelection = () => {
|
|
|
829
859
|
|
|
830
860
|
export const viewSlateSelection = () => {
|
|
831
861
|
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
|
832
|
-
clearWindowSelection();
|
|
862
|
+
// clearWindowSelection();
|
|
863
|
+
|
|
833
864
|
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
|
834
865
|
const root = document.documentElement;
|
|
835
866
|
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
|
@@ -983,4 +1014,71 @@ export const handleCopy = (event, editor) => {
|
|
|
983
1014
|
event.clipboardData?.setData("text/plain", text);
|
|
984
1015
|
event.clipboardData?.setData("application/x-slate-fragment", encodedFragment);
|
|
985
1016
|
};
|
|
986
|
-
export const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "blockquote"];
|
|
1017
|
+
export const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "blockquote"];
|
|
1018
|
+
function convertColorToRgb(color) {
|
|
1019
|
+
if (color?.startsWith("#")) {
|
|
1020
|
+
// HEX to RGB
|
|
1021
|
+
let hex = color.replace("#", "");
|
|
1022
|
+
let r, g, b;
|
|
1023
|
+
if (hex.length === 3) {
|
|
1024
|
+
hex = hex.split("").map(x => x + x).join("");
|
|
1025
|
+
}
|
|
1026
|
+
if (hex.length === 6) {
|
|
1027
|
+
[r, g, b] = [hex.substring(0, 2), hex.substring(2, 4), hex.substring(4, 6)].map(val => parseInt(val, 16));
|
|
1028
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
1029
|
+
}
|
|
1030
|
+
} else {
|
|
1031
|
+
return color;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
export const getSelectedColor = (selectedColor, theme, hideThemeColors) => {
|
|
1035
|
+
const colorVars = hideThemeColors ? null : theme?.vars?.colors;
|
|
1036
|
+
let selectedValue = selectedColor;
|
|
1037
|
+
if (colorVars) {
|
|
1038
|
+
const convertedColor = convertColorToRgb(selectedColor);
|
|
1039
|
+
Object.entries(theme.colors).forEach(([key, value]) => {
|
|
1040
|
+
const convertedThemeColor = convertColorToRgb(value);
|
|
1041
|
+
if (convertedThemeColor === convertedColor) {
|
|
1042
|
+
selectedValue = colorVars[key];
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
return selectedValue;
|
|
1047
|
+
};
|
|
1048
|
+
const themeTextFormats = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
|
|
1049
|
+
export const getSelectedElementColor = (editor, format, theme) => {
|
|
1050
|
+
const [isThemeText] = Editor.nodes(editor, {
|
|
1051
|
+
at: editor.selection,
|
|
1052
|
+
match: n => themeTextFormats.includes(n?.type)
|
|
1053
|
+
});
|
|
1054
|
+
if (!isThemeText) {
|
|
1055
|
+
return activeMark(editor, "color") || "#000000";
|
|
1056
|
+
}
|
|
1057
|
+
const color = getSelectedElementStyle(format, editor, format);
|
|
1058
|
+
return getSelectedColor(color, theme);
|
|
1059
|
+
};
|
|
1060
|
+
export const GetsectionBgImage = sectionBackgroundImage => {
|
|
1061
|
+
if (sectionBackgroundImage && sectionBackgroundImage !== "none") {
|
|
1062
|
+
if (typeof sectionBackgroundImage === "object") {
|
|
1063
|
+
return {
|
|
1064
|
+
backgroundImage: `url(${sectionBackgroundImage?.embedURL})`
|
|
1065
|
+
};
|
|
1066
|
+
} else if (typeof sectionBackgroundImage === "string") {
|
|
1067
|
+
return {
|
|
1068
|
+
backgroundImage: `url(${sectionBackgroundImage})`
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
} else {
|
|
1072
|
+
return {};
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
export const GetPageBgImage = pageBgImage => {
|
|
1076
|
+
if (pageBgImage && pageBgImage !== "none") {
|
|
1077
|
+
if (typeof pageBgImage === "object") {
|
|
1078
|
+
return pageBgImage.embedURL;
|
|
1079
|
+
} else if (typeof pageBgImage === "string") {
|
|
1080
|
+
return pageBgImage;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
return null;
|
|
1084
|
+
};
|
|
@@ -8,27 +8,31 @@ export const appHeaderNode = ({
|
|
|
8
8
|
appLogo: "none",
|
|
9
9
|
menus: menus || [{
|
|
10
10
|
type: "menu",
|
|
11
|
-
url: "
|
|
11
|
+
url: "",
|
|
12
|
+
placeholder: "home",
|
|
12
13
|
target: "",
|
|
13
14
|
text: "Home",
|
|
14
15
|
linkType: "page"
|
|
15
16
|
}, {
|
|
16
17
|
type: "menu",
|
|
17
|
-
url: "
|
|
18
|
+
url: "",
|
|
19
|
+
placeholder: "wireframe2",
|
|
18
20
|
target: "",
|
|
19
21
|
text: "Wireframe",
|
|
20
22
|
linkType: "page"
|
|
21
23
|
}, {
|
|
22
24
|
type: "menu",
|
|
23
|
-
url: "
|
|
25
|
+
url: "",
|
|
24
26
|
target: "",
|
|
27
|
+
placeholder: "Work",
|
|
25
28
|
text: "Work",
|
|
26
29
|
linkType: "webAddress"
|
|
27
30
|
}, {
|
|
28
31
|
type: "menu",
|
|
29
|
-
url: "
|
|
32
|
+
url: "",
|
|
30
33
|
target: "",
|
|
31
34
|
text: "Contact",
|
|
35
|
+
placeholder: "Contact",
|
|
32
36
|
linkType: "webAddress"
|
|
33
37
|
}],
|
|
34
38
|
menuStyle: "stacked",
|