@flozy/editor 11.2.3 → 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 +32 -44
- 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 +5 -15
- 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 +10 -19
- 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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import Dialog from "@mui/material/Dialog";
|
|
2
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
3
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
4
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
5
|
+
import IconButton from "@mui/material/IconButton";
|
|
6
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
7
|
+
import { Box, Typography, Button } from "@mui/material";
|
|
8
|
+
import SwipeableDrawer from "../SwipeableDrawer";
|
|
9
|
+
import customDialogStyles from "./style";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
function CustomDialog(props) {
|
|
14
|
+
const {
|
|
15
|
+
handleClose,
|
|
16
|
+
customProps,
|
|
17
|
+
children,
|
|
18
|
+
onSubmit
|
|
19
|
+
} = props;
|
|
20
|
+
const {
|
|
21
|
+
isMobile
|
|
22
|
+
} = customProps;
|
|
23
|
+
const classes = customDialogStyles();
|
|
24
|
+
if (isMobile) {
|
|
25
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
26
|
+
sx: classes.dialogContainer,
|
|
27
|
+
children: /*#__PURE__*/_jsxs(SwipeableDrawer, {
|
|
28
|
+
onClose: handleClose,
|
|
29
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
30
|
+
variant: "subtitle1",
|
|
31
|
+
gutterBottom: true,
|
|
32
|
+
sx: {
|
|
33
|
+
fontWeight: 600
|
|
34
|
+
},
|
|
35
|
+
children: "What do you want to link to?"
|
|
36
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
37
|
+
sx: classes.mobileDialogContent,
|
|
38
|
+
children: children
|
|
39
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
40
|
+
component: "div",
|
|
41
|
+
sx: classes.mobileActionBtns,
|
|
42
|
+
children: /*#__PURE__*/_jsx(ActionsButtons, {
|
|
43
|
+
classes: classes,
|
|
44
|
+
onCancel: handleClose,
|
|
45
|
+
onSave: onSubmit
|
|
46
|
+
})
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
52
|
+
onClose: handleClose,
|
|
53
|
+
open: true,
|
|
54
|
+
sx: classes.dialogContainer,
|
|
55
|
+
fullWidth: true,
|
|
56
|
+
maxWidth: "sm",
|
|
57
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
|
58
|
+
children: "What do you want to link to?"
|
|
59
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
60
|
+
"aria-label": "close",
|
|
61
|
+
onClick: handleClose,
|
|
62
|
+
sx: classes.closeIcon,
|
|
63
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
|
64
|
+
}), /*#__PURE__*/_jsx(DialogContent, {
|
|
65
|
+
dividers: true,
|
|
66
|
+
children: children
|
|
67
|
+
}), /*#__PURE__*/_jsx(DialogActions, {
|
|
68
|
+
children: /*#__PURE__*/_jsx(ActionsButtons, {
|
|
69
|
+
classes: classes,
|
|
70
|
+
onCancel: handleClose,
|
|
71
|
+
onSave: onSubmit
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export default CustomDialog;
|
|
78
|
+
function ActionsButtons({
|
|
79
|
+
classes,
|
|
80
|
+
onCancel,
|
|
81
|
+
onSave
|
|
82
|
+
}) {
|
|
83
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
84
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
85
|
+
onClick: onCancel,
|
|
86
|
+
sx: classes.closeBtn,
|
|
87
|
+
children: "Cancel"
|
|
88
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
89
|
+
onClick: onSave,
|
|
90
|
+
sx: classes.saveBtn,
|
|
91
|
+
children: "Save"
|
|
92
|
+
})]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const styles = () => ({
|
|
2
|
+
dialogContainer: {
|
|
3
|
+
"& .MuiDialogContent-root": {
|
|
4
|
+
padding: "0px 20px"
|
|
5
|
+
},
|
|
6
|
+
"& .MuiDialogActions-root": {
|
|
7
|
+
padding: "10px"
|
|
8
|
+
},
|
|
9
|
+
"& .MuiTypography-h6": {
|
|
10
|
+
fontWeight: 600,
|
|
11
|
+
fontSize: "16px",
|
|
12
|
+
paddingRight: "20px"
|
|
13
|
+
},
|
|
14
|
+
"& .MuiGrid-container": {
|
|
15
|
+
marginTop: "0px"
|
|
16
|
+
},
|
|
17
|
+
"& .MuiGrid-item": {
|
|
18
|
+
padding: "14px"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
saveBtn: {
|
|
22
|
+
color: "#fff",
|
|
23
|
+
background: "#2563EB",
|
|
24
|
+
fontSize: "14px",
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
padding: "4px 24px",
|
|
27
|
+
textTransform: "none",
|
|
28
|
+
"&:hover": {
|
|
29
|
+
color: "#fff",
|
|
30
|
+
background: "#2563EB"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
closeBtn: {
|
|
34
|
+
backgroundColor: "#F4F6F9",
|
|
35
|
+
color: "#64748B",
|
|
36
|
+
fontSize: "14px",
|
|
37
|
+
fontWeight: 500,
|
|
38
|
+
padding: "4px 22px",
|
|
39
|
+
textTransform: "none",
|
|
40
|
+
border: "1px solid #D8DDE1",
|
|
41
|
+
"&:hover": {
|
|
42
|
+
border: "1px solid #64748B"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
closeIcon: {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
right: 8,
|
|
48
|
+
top: 8,
|
|
49
|
+
color: theme => theme.palette.grey[500]
|
|
50
|
+
},
|
|
51
|
+
gridDivider: {
|
|
52
|
+
borderRight: "1px solid rgba(0, 0, 0, 0.12)"
|
|
53
|
+
},
|
|
54
|
+
mobileActionBtns: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
justifyContent: "flex-end",
|
|
57
|
+
gap: "8px",
|
|
58
|
+
paddingTop: "14px",
|
|
59
|
+
marginTop: "14px",
|
|
60
|
+
borderTop: theme => `1px solid ${theme.palette.grey[300]}`
|
|
61
|
+
},
|
|
62
|
+
mobileDialogContent: {
|
|
63
|
+
borderTop: theme => `1px solid ${theme.palette.grey[300]}`,
|
|
64
|
+
paddingTop: "14px"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
export default styles;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MenuItem, Select } from "@mui/material";
|
|
2
|
+
import { fontFamilyMap } from "../utils/font";
|
|
3
|
+
import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
function CustomSelect(props) {
|
|
6
|
+
const {
|
|
7
|
+
classes,
|
|
8
|
+
onChange,
|
|
9
|
+
options = [],
|
|
10
|
+
value
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
13
|
+
fullWidth: true,
|
|
14
|
+
value: value,
|
|
15
|
+
onChange: onChange,
|
|
16
|
+
className: "editor-dd",
|
|
17
|
+
style: {
|
|
18
|
+
fontFamily: fontFamilyMap[value],
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "36px",
|
|
21
|
+
borderRadius: "10px",
|
|
22
|
+
fontSize: "14px"
|
|
23
|
+
},
|
|
24
|
+
MenuProps: {
|
|
25
|
+
PaperProps: {
|
|
26
|
+
sx: classes?.textOptions
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
sx: classes.textFormatSelect,
|
|
30
|
+
IconComponent: KeyboardArrowDownRoundedIcon,
|
|
31
|
+
children: options.map((option, i) => {
|
|
32
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
|
33
|
+
value: option.value,
|
|
34
|
+
style: {
|
|
35
|
+
fontFamily: option.text || "inherit"
|
|
36
|
+
},
|
|
37
|
+
sx: classes.textFormatSelectOptions,
|
|
38
|
+
children: option?.label || option?.text
|
|
39
|
+
}, i);
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export default CustomSelect;
|
|
@@ -7,7 +7,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
|
|
|
7
7
|
import { Transforms } from "slate";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const DRAGGABLE_TYPES = ["paragraph", "headingOne", "headingTwo", "headingThree", "grid"];
|
|
10
|
+
const DRAGGABLE_TYPES = ["paragraph", "headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree", "grid"];
|
|
11
11
|
const DragHandleStyle = fromPopper => {
|
|
12
12
|
const handleDragStyle = fromPopper ? {
|
|
13
13
|
position: "absolute",
|
|
@@ -97,6 +97,7 @@ const FontLoader = props => {
|
|
|
97
97
|
});
|
|
98
98
|
let families = Array.from(fontSet);
|
|
99
99
|
families = correctFontArray(families.join(", "));
|
|
100
|
+
// eslint-disable-next-line no-useless-escape
|
|
100
101
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
|
101
102
|
families = families?.map(font => font?.replace(", sans-serif", ""));
|
|
102
103
|
families = families?.filter(font => googleFontList?.includes(font));
|
|
@@ -48,6 +48,16 @@ import ChervUp from "../assets/svg/ChervUp";
|
|
|
48
48
|
import ResetIconNew from "../assets/svg/ResetIconNew";
|
|
49
49
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
50
50
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
51
|
+
const HeadingIcon = ({
|
|
52
|
+
variant
|
|
53
|
+
}) => {
|
|
54
|
+
return /*#__PURE__*/_jsx("div", {
|
|
55
|
+
style: {
|
|
56
|
+
color: "#64748B"
|
|
57
|
+
},
|
|
58
|
+
children: variant
|
|
59
|
+
});
|
|
60
|
+
};
|
|
51
61
|
const iconList = {
|
|
52
62
|
fontFamily: /*#__PURE__*/_jsx(FontFamilyIcon, {
|
|
53
63
|
size: 20
|
|
@@ -80,6 +90,24 @@ const iconList = {
|
|
|
80
90
|
size: 18,
|
|
81
91
|
fill: "#64748B"
|
|
82
92
|
}),
|
|
93
|
+
headingFour: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
94
|
+
variant: "H4"
|
|
95
|
+
}),
|
|
96
|
+
headingFive: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
97
|
+
variant: "H5"
|
|
98
|
+
}),
|
|
99
|
+
headingSix: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
100
|
+
variant: "H6"
|
|
101
|
+
}),
|
|
102
|
+
paragraphOne: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
103
|
+
variant: "P1"
|
|
104
|
+
}),
|
|
105
|
+
paragraphTwo: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
106
|
+
variant: "P2"
|
|
107
|
+
}),
|
|
108
|
+
paragraphThree: /*#__PURE__*/_jsx(HeadingIcon, {
|
|
109
|
+
variant: "P3"
|
|
110
|
+
}),
|
|
83
111
|
blockquote: /*#__PURE__*/_jsx(MdFormatQuote, {
|
|
84
112
|
size: 20,
|
|
85
113
|
fill: "#64748B",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useCallback } from "react";
|
|
2
2
|
import { Button, Grid, Tab, Tabs, Dialog, DialogContent, DialogActions, DialogTitle, Typography, Divider, Box, IconButton } from "@mui/material";
|
|
3
3
|
import Upload from "./Options/Upload";
|
|
4
4
|
import ChooseAssets from "./Options/ChooseAssets";
|
|
@@ -7,19 +7,21 @@ import Icon from "../Icon";
|
|
|
7
7
|
import ImageSelectorStyles from "./Styles";
|
|
8
8
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
9
9
|
import { CloseIconImageUpload, ImageElementIcon } from "../iconListV2";
|
|
10
|
+
import RecentUploads from "./Options/RecentUploads";
|
|
10
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const IMAGE_SLECTOR_OPTIONS = {
|
|
14
15
|
upload: Upload,
|
|
15
16
|
choose: ChooseAssets,
|
|
16
|
-
addLink: AddLink
|
|
17
|
+
addLink: AddLink,
|
|
18
|
+
recent: RecentUploads
|
|
17
19
|
};
|
|
18
20
|
const TAB_SHOW = {
|
|
19
|
-
Image: ["upload", "choose", "addLink"],
|
|
20
|
-
Video: ["addLink"],
|
|
21
|
+
Image: ["recent", "upload", "choose", "addLink"],
|
|
22
|
+
Video: ["recent", "upload", "addLink"],
|
|
21
23
|
Embed: ["addLink"],
|
|
22
|
-
Document: ["addLink", "upload"]
|
|
24
|
+
Document: ["recent", "addLink", "upload"]
|
|
23
25
|
};
|
|
24
26
|
const ImageSelector = props => {
|
|
25
27
|
const {
|
|
@@ -31,21 +33,58 @@ const ImageSelector = props => {
|
|
|
31
33
|
onClose,
|
|
32
34
|
open,
|
|
33
35
|
onSelectImage,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
customProps,
|
|
37
|
+
setUploadStatus = () => {},
|
|
38
|
+
disableProgress
|
|
36
39
|
} = props;
|
|
40
|
+
const {
|
|
41
|
+
uploadTerminator
|
|
42
|
+
} = customProps;
|
|
43
|
+
const [uniqueId, setUniqueId] = useState(null);
|
|
44
|
+
const title = props.title || "Image";
|
|
37
45
|
const translation = customProps?.translation;
|
|
38
46
|
const [tabValue, setTabValue] = useState(title === "Image" ? "choose" : "addLink");
|
|
39
47
|
const [image, setImage] = useState(value || "");
|
|
48
|
+
const [imageSource, setImageSource] = useState(null);
|
|
49
|
+
const [s3UploadProp, setS3UploadProp] = useState({
|
|
50
|
+
file: null,
|
|
51
|
+
pageId: null,
|
|
52
|
+
services: customProps?.services,
|
|
53
|
+
setUploadStatus: setUploadStatus
|
|
54
|
+
});
|
|
40
55
|
const handleTabChange = (e, newValue) => {
|
|
41
56
|
setImage("");
|
|
57
|
+
setImageSource(null);
|
|
42
58
|
setTabValue(newValue);
|
|
59
|
+
setS3UploadProp({
|
|
60
|
+
file: null,
|
|
61
|
+
pageId: null,
|
|
62
|
+
services: customProps?.services,
|
|
63
|
+
setUploadStatus: setUploadStatus
|
|
64
|
+
});
|
|
43
65
|
};
|
|
44
|
-
const onUploaded = url => {
|
|
66
|
+
const onUploaded = useCallback((url, source = null) => {
|
|
45
67
|
setImage(url);
|
|
46
|
-
|
|
68
|
+
setImageSource(source);
|
|
69
|
+
}, []);
|
|
47
70
|
const onSave = () => {
|
|
48
|
-
|
|
71
|
+
if (tabValue === "upload") {
|
|
72
|
+
if (disableProgress) {
|
|
73
|
+
onSelectImage(image);
|
|
74
|
+
} else {
|
|
75
|
+
onSelectImage(s3UploadProp);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
onSelectImage({
|
|
79
|
+
embedURL: image,
|
|
80
|
+
isUpload: false,
|
|
81
|
+
source: imageSource
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onCloseUpload = () => {
|
|
86
|
+
uploadTerminator(uniqueId, setUploadStatus);
|
|
87
|
+
onClose();
|
|
49
88
|
};
|
|
50
89
|
const isActive = val => tabValue === val ? "active" : "";
|
|
51
90
|
const Comp = IMAGE_SLECTOR_OPTIONS[tabValue] || /*#__PURE__*/_jsx(_Fragment, {});
|
|
@@ -93,6 +132,15 @@ const ImageSelector = props => {
|
|
|
93
132
|
variant: "scrollable",
|
|
94
133
|
scrollButtons: "auto",
|
|
95
134
|
children: [/*#__PURE__*/_jsx(Tab, {
|
|
135
|
+
className: `${isActive("recent")} ${TAB_SHOW[title].indexOf("recent") === -1 ? "hidden" : ""}`,
|
|
136
|
+
sx: classes.tab,
|
|
137
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
138
|
+
icon: "resetIcon"
|
|
139
|
+
}),
|
|
140
|
+
iconPosition: "start",
|
|
141
|
+
value: "recent",
|
|
142
|
+
label: `${translation("Recent")} ${translation(title)}`
|
|
143
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
|
96
144
|
className: `${isActive("upload")} ${TAB_SHOW[title].indexOf("upload") === -1 ? "hidden" : ""}`,
|
|
97
145
|
sx: classes.tab,
|
|
98
146
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -129,7 +177,12 @@ const ImageSelector = props => {
|
|
|
129
177
|
children: /*#__PURE__*/_jsx(Comp, {
|
|
130
178
|
...props,
|
|
131
179
|
classes: classes,
|
|
132
|
-
onUploaded: onUploaded
|
|
180
|
+
onUploaded: onUploaded,
|
|
181
|
+
setS3UploadProp: setS3UploadProp,
|
|
182
|
+
s3UploadProp: s3UploadProp,
|
|
183
|
+
disableProgress: disableProgress,
|
|
184
|
+
setUniqueId: setUniqueId,
|
|
185
|
+
uniqueId: uniqueId
|
|
133
186
|
})
|
|
134
187
|
})]
|
|
135
188
|
})
|
|
@@ -143,12 +196,12 @@ const ImageSelector = props => {
|
|
|
143
196
|
p: 2
|
|
144
197
|
},
|
|
145
198
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
146
|
-
onClick:
|
|
199
|
+
onClick: onCloseUpload,
|
|
147
200
|
className: "secondaryBtn",
|
|
148
201
|
sx: classes.closeBtn,
|
|
149
202
|
children: translation("Cancel")
|
|
150
203
|
}), /*#__PURE__*/_jsx(Button, {
|
|
151
|
-
disabled: !image,
|
|
204
|
+
disabled: tabValue === "upload" ? !s3UploadProp?.file : !image,
|
|
152
205
|
onClick: onSave,
|
|
153
206
|
className: `primaryBtn ${!image ? "disabled" : ""}`,
|
|
154
207
|
sx: classes.saveBtn,
|