@flozy/editor 10.4.2 → 10.4.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 +16 -17
- package/dist/Editor/CommonEditor.js +16 -131
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +8 -46
- package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
- package/dist/Editor/Elements/Accordion/Accordion.js +9 -46
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +23 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -10
- package/dist/Editor/Elements/Button/EditorButton.js +9 -27
- package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
- package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +26 -26
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -5
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +1 -0
- package/dist/Editor/Elements/Embed/Video.js +1 -1
- package/dist/Editor/Elements/Form/Form.js +3 -3
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -0
- package/dist/Editor/Elements/Form/FormField.js +2 -3
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +31 -35
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -7
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -1
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -14
- package/dist/Editor/Elements/Grid/Grid.js +2 -14
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/Signature/Signature.css +1 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +5 -18
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +3 -16
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/DragButton.js +1 -0
- package/dist/Editor/Elements/Table/Draggable.js +2 -6
- package/dist/Editor/Elements/Table/Styles.js +0 -7
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +5 -24
- package/dist/Editor/Elements/Title/title.js +6 -6
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +1 -2
- package/dist/Editor/Styles/EditorStyles.js +5 -5
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -72
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +10 -58
- package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +16 -41
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
- package/dist/Editor/common/Icon.js +0 -28
- package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +65 -45
- package/dist/Editor/common/LinkSettings/index.js +28 -14
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
- package/dist/Editor/common/LinkSettings/style.js +244 -164
- package/dist/Editor/common/MentionsPopup/index.js +1 -4
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +5 -4
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +3 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -11
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +19 -28
- package/dist/Editor/common/RnD/Utils/index.js +1 -3
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -42
- package/dist/Editor/common/RnD/VirtualElement/helper.js +132 -323
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -16
- package/dist/Editor/common/RnD/index.js +39 -68
- package/dist/Editor/common/Select/index.js +7 -44
- package/dist/Editor/common/Select/styles.js +2 -30
- package/dist/Editor/common/Shorthands/elements.js +0 -54
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +9 -12
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
- package/dist/Editor/common/SwipeableDrawer/style.js +12 -14
- package/dist/Editor/common/Uploader.js +0 -16
- package/dist/Editor/common/iconListV2.js +0 -76
- package/dist/Editor/common/iconslist.js +0 -21
- package/dist/Editor/commonStyle.js +61 -116
- package/dist/Editor/helper/index.js +1 -5
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +3 -9
- package/dist/Editor/hooks/useTable.js +4 -5
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +37 -161
- package/dist/Editor/utils/accordion.js +4 -14
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/customHooks/useTableResize.js +9 -49
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/events.js +6 -50
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/formfield.js +0 -1
- package/dist/Editor/utils/helper.js +26 -210
- package/dist/Editor/utils/insertAppHeader.js +1 -1
- package/dist/Editor/utils/signature.js +9 -2
- package/package.json +4 -4
- package/dist/Editor/Elements/FreeGrid/helper.js +0 -115
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
- package/dist/Editor/assets/svg/BackIcon.js +0 -18
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
- package/dist/Editor/common/Checkbox/index.js +0 -46
- package/dist/Editor/common/Checkbox/styles.js +0 -45
- package/dist/Editor/common/CustomColorPicker/index.js +0 -130
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog2/index.js +0 -94
- package/dist/Editor/common/CustomDialog2/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -43
- package/dist/Editor/common/RadioGroup/index.js +0 -48
- package/dist/Editor/common/RadioGroup/styles.js +0 -29
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
- package/dist/Editor/helper/textIndeces.js +0 -58
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/hooks/useThemeValues.js +0 -63
- package/dist/Editor/theme/index.js +0 -149
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
- package/dist/Editor/themeSettings/buttons/index.js +0 -300
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -240
- package/dist/Editor/themeSettings/fonts/style.js +0 -62
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -380
- package/dist/Editor/themeSettings/style.js +0 -299
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
- package/dist/Editor/themeSettingsAI/style.js +0 -332
- package/dist/Editor/utils/updateFormName.js +0 -22
@@ -1,67 +0,0 @@
|
|
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;
|
@@ -1,43 +0,0 @@
|
|
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;
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { RadioGroup as Core, Radio, FormControl, FormControlLabel, IconButton, Typography } from "@mui/material";
|
2
|
-
import RadioGroupStyles from "./styles";
|
3
|
-
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
-
import { CheckedRadioIcon } from "../iconListV2";
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
function RadioGroup(props) {
|
7
|
-
const {
|
8
|
-
value,
|
9
|
-
options,
|
10
|
-
onChange,
|
11
|
-
label,
|
12
|
-
labelProps,
|
13
|
-
radioProps,
|
14
|
-
translation,
|
15
|
-
...rest
|
16
|
-
} = props;
|
17
|
-
const {
|
18
|
-
theme
|
19
|
-
} = useEditorContext();
|
20
|
-
const classes = RadioGroupStyles(theme);
|
21
|
-
return /*#__PURE__*/_jsx(FormControl, {
|
22
|
-
children: /*#__PURE__*/_jsx(Core, {
|
23
|
-
value: value,
|
24
|
-
sx: classes.customRadioGroup,
|
25
|
-
...rest,
|
26
|
-
children: options?.map((option, i) => {
|
27
|
-
return /*#__PURE__*/_jsx(FormControlLabel, {
|
28
|
-
value: option.value,
|
29
|
-
control: /*#__PURE__*/_jsx(Radio, {
|
30
|
-
checkedIcon: /*#__PURE__*/_jsx(CheckedRadioIcon, {}),
|
31
|
-
icon: /*#__PURE__*/_jsx(IconButton, {
|
32
|
-
className: "unCheckedIcon"
|
33
|
-
}),
|
34
|
-
...(radioProps || {})
|
35
|
-
}),
|
36
|
-
label: /*#__PURE__*/_jsx(Typography, {
|
37
|
-
variant: "body1",
|
38
|
-
sx: classes.label,
|
39
|
-
...(labelProps || {}),
|
40
|
-
children: translation(option.label)
|
41
|
-
}),
|
42
|
-
onChange: () => onChange(option)
|
43
|
-
}, i);
|
44
|
-
})
|
45
|
-
})
|
46
|
-
});
|
47
|
-
}
|
48
|
-
export default RadioGroup;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
const SelectStyles = (theme = {}) => {
|
2
|
-
const {
|
3
|
-
buttonBorder3,
|
4
|
-
checkedIconBg,
|
5
|
-
tv_text,
|
6
|
-
inputFieldBgColor
|
7
|
-
} = theme?.palette?.editor || {};
|
8
|
-
return {
|
9
|
-
customRadioGroup: {
|
10
|
-
gap: "4px",
|
11
|
-
"& button": {
|
12
|
-
border: `1px solid ${buttonBorder3}`
|
13
|
-
},
|
14
|
-
"& .unCheckedIcon": {
|
15
|
-
background: checkedIconBg,
|
16
|
-
width: "17px",
|
17
|
-
height: "17px",
|
18
|
-
padding: "0px"
|
19
|
-
},
|
20
|
-
"& .radio-icon-path": {
|
21
|
-
fill: inputFieldBgColor
|
22
|
-
}
|
23
|
-
},
|
24
|
-
label: {
|
25
|
-
color: `${tv_text} !important`
|
26
|
-
}
|
27
|
-
};
|
28
|
-
};
|
29
|
-
export default SelectStyles;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
-
function MainThemeProvider({
|
4
|
-
children,
|
5
|
-
userSelectedTheme,
|
6
|
-
theme = {}
|
7
|
-
}) {
|
8
|
-
const themeVars = extendTheme(userSelectedTheme?.theme?.cssVars || {});
|
9
|
-
return /*#__PURE__*/_jsx(CssVarsProvider, {
|
10
|
-
theme: {
|
11
|
-
...themeVars,
|
12
|
-
...theme
|
13
|
-
},
|
14
|
-
children: children
|
15
|
-
});
|
16
|
-
}
|
17
|
-
export default MainThemeProvider;
|
@@ -1,115 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Grid, Button, Typography } from "@mui/material";
|
3
|
-
import ImageSelector from "../../ImageSelector/ImageSelector";
|
4
|
-
import UploadStyles from "../../ImageSelector/UploadStyles";
|
5
|
-
import Icon from "../../Icon";
|
6
|
-
import { useEditorContext } from "../../../hooks/useMouseMove";
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
-
const EmbedUpload = props => {
|
10
|
-
const {
|
11
|
-
value,
|
12
|
-
data,
|
13
|
-
customProps,
|
14
|
-
onChange
|
15
|
-
} = props;
|
16
|
-
const {
|
17
|
-
translation
|
18
|
-
} = customProps;
|
19
|
-
const {
|
20
|
-
key
|
21
|
-
} = data;
|
22
|
-
const [base64, setBase64] = useState(value);
|
23
|
-
const [open, setOpen] = useState(false);
|
24
|
-
const {
|
25
|
-
theme
|
26
|
-
} = useEditorContext();
|
27
|
-
const classes = UploadStyles(theme);
|
28
|
-
const onRemoveBG = () => {
|
29
|
-
setBase64(null);
|
30
|
-
onChange({
|
31
|
-
[key]: "none"
|
32
|
-
});
|
33
|
-
};
|
34
|
-
const handleClick = () => {
|
35
|
-
setOpen(true);
|
36
|
-
};
|
37
|
-
const handleClose = () => {
|
38
|
-
setOpen(false);
|
39
|
-
};
|
40
|
-
const onSelectImage = img => {
|
41
|
-
setBase64(img);
|
42
|
-
onChange({
|
43
|
-
[key]: img
|
44
|
-
});
|
45
|
-
handleClose();
|
46
|
-
};
|
47
|
-
return /*#__PURE__*/_jsxs(Grid, {
|
48
|
-
item: true,
|
49
|
-
xs: 12,
|
50
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
51
|
-
variant: "body1",
|
52
|
-
color: "primary",
|
53
|
-
sx: {
|
54
|
-
fontSize: "14px",
|
55
|
-
fontWeight: "500",
|
56
|
-
marginBottom: "8px"
|
57
|
-
},
|
58
|
-
children: translation("Upload Video")
|
59
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
60
|
-
container: true,
|
61
|
-
sx: classes.uploadContainer,
|
62
|
-
children: /*#__PURE__*/_jsx(Grid, {
|
63
|
-
item: true,
|
64
|
-
xs: 12,
|
65
|
-
sx: classes.uploadField,
|
66
|
-
children: /*#__PURE__*/_jsx(Grid, {
|
67
|
-
className: "uploadImageSection",
|
68
|
-
children: base64 ? /*#__PURE__*/_jsxs(Grid, {
|
69
|
-
justifyItems: "center",
|
70
|
-
alignItems: "center",
|
71
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
72
|
-
style: {
|
73
|
-
padding: "8px",
|
74
|
-
fontSize: "8px",
|
75
|
-
color: theme?.palette?.editor?.textColor,
|
76
|
-
textAlign: "center"
|
77
|
-
},
|
78
|
-
children: base64
|
79
|
-
}), /*#__PURE__*/_jsx(Grid, {
|
80
|
-
className: "removeImageText",
|
81
|
-
onClick: onRemoveBG,
|
82
|
-
children: translation("REMOVE")
|
83
|
-
})]
|
84
|
-
}) : /*#__PURE__*/_jsx(Grid, {
|
85
|
-
className: "uploadImageText",
|
86
|
-
children: /*#__PURE__*/_jsxs(Button, {
|
87
|
-
component: "label",
|
88
|
-
variant: "text",
|
89
|
-
style: {
|
90
|
-
background: "none"
|
91
|
-
},
|
92
|
-
onClick: handleClick,
|
93
|
-
sx: classes.uploadIcon,
|
94
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
95
|
-
icon: "fileUpload"
|
96
|
-
}), /*#__PURE__*/_jsx("span", {
|
97
|
-
style: {
|
98
|
-
paddingLeft: "8px"
|
99
|
-
},
|
100
|
-
children: translation("Upload a Video")
|
101
|
-
})]
|
102
|
-
})
|
103
|
-
})
|
104
|
-
})
|
105
|
-
})
|
106
|
-
}), /*#__PURE__*/_jsx(ImageSelector, {
|
107
|
-
open: open,
|
108
|
-
title: "Video",
|
109
|
-
onClose: handleClose,
|
110
|
-
customProps: customProps,
|
111
|
-
onSelectImage: onSelectImage
|
112
|
-
})]
|
113
|
-
});
|
114
|
-
};
|
115
|
-
export default EmbedUpload;
|
@@ -1,58 +0,0 @@
|
|
1
|
-
export function extractTextWithPath(data, path = []) {
|
2
|
-
let result = [];
|
3
|
-
data.forEach((item, index) => {
|
4
|
-
const currentPath = [...path, index];
|
5
|
-
if (item.text) {
|
6
|
-
result.push({
|
7
|
-
path_id: currentPath.join(","),
|
8
|
-
text: item.text
|
9
|
-
});
|
10
|
-
}
|
11
|
-
if (item.children) {
|
12
|
-
result = result.concat(extractTextWithPath(item.children, currentPath));
|
13
|
-
}
|
14
|
-
});
|
15
|
-
return result;
|
16
|
-
}
|
17
|
-
export function replaceTextPath(nestedJson, pathIdJson) {
|
18
|
-
// Create a map from path_id JSON for quick lookup
|
19
|
-
const pathIdMap = new Map(pathIdJson.map(item => [item.path_id, item.text]));
|
20
|
-
console.log(pathIdMap);
|
21
|
-
function extractTextWithPath(data, path = []) {
|
22
|
-
data.forEach((item, index) => {
|
23
|
-
const currentPath = [...path, index];
|
24
|
-
if (item.text) {
|
25
|
-
if (pathIdMap.has(currentPath?.join(","))) {
|
26
|
-
item.text = pathIdMap.get(currentPath?.join(","));
|
27
|
-
}
|
28
|
-
}
|
29
|
-
if (item.children) {
|
30
|
-
extractTextWithPath(item.children, currentPath);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
extractTextWithPath(nestedJson, []);
|
35
|
-
return nestedJson;
|
36
|
-
}
|
37
|
-
|
38
|
-
// export function replaceTextPath(nestedJson, pathIdJson) {
|
39
|
-
// // Create a map from path_id JSON for quick lookup
|
40
|
-
// const pathIdMap = new Map(
|
41
|
-
// pathIdJson.map((item) => [item.path_id, item.text])
|
42
|
-
// );
|
43
|
-
|
44
|
-
// function traverseAndReplace(node) {
|
45
|
-
// if (Array.isArray(node)) {
|
46
|
-
// node.forEach(traverseAndReplace);
|
47
|
-
// } else if (typeof node === "object" && node !== null) {
|
48
|
-
// console.log(node);
|
49
|
-
// if (node.text && pathIdMap.has(node.text)) {
|
50
|
-
// node.text = pathIdMap.get(node.path_id);
|
51
|
-
// }
|
52
|
-
// Object.values(node).forEach(traverseAndReplace);
|
53
|
-
// }
|
54
|
-
// }
|
55
|
-
|
56
|
-
// traverseAndReplace(nestedJson);
|
57
|
-
// return nestedJson;
|
58
|
-
// }
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import { useSlate } from "slate-react";
|
2
|
-
import { defaultTheme } from "../theme";
|
3
|
-
import { getPageSettings, updatePageSettings } from "../utils/pageSettings";
|
4
|
-
import { HEADING_THEME_FIELDS, PARAGRAPH_THEME_FIELDS } from "../helper/theme";
|
5
|
-
import { useEditorContext } from "./useMouseMove";
|
6
|
-
const MAP_FIELDS = {
|
7
|
-
HEADING: HEADING_THEME_FIELDS,
|
8
|
-
PARAGRAPH: PARAGRAPH_THEME_FIELDS
|
9
|
-
};
|
10
|
-
const MAP_FONT_FIELD_KEYS = {
|
11
|
-
HEADING: "headingFontFamily",
|
12
|
-
PARAGRAPH: "paragraphFontFamily"
|
13
|
-
};
|
14
|
-
function getUpdatePayload(prevTheme = {}, update, actionData) {
|
15
|
-
const {
|
16
|
-
action,
|
17
|
-
fieldName
|
18
|
-
} = actionData || {};
|
19
|
-
const {
|
20
|
-
theme: prev
|
21
|
-
} = prevTheme;
|
22
|
-
let theme = {};
|
23
|
-
let themeProps = {};
|
24
|
-
switch (action) {
|
25
|
-
case "THEME_CHANGE":
|
26
|
-
theme = update;
|
27
|
-
break;
|
28
|
-
case "CSS_VAR_CHANGE":
|
29
|
-
const prevCssVars = prev?.cssVars || {};
|
30
|
-
const prevValue = prevCssVars[fieldName] || {};
|
31
|
-
themeProps = {
|
32
|
-
...(prev || {}),
|
33
|
-
cssVars: {
|
34
|
-
...prevCssVars,
|
35
|
-
[fieldName]: {
|
36
|
-
...prevValue,
|
37
|
-
...update
|
38
|
-
}
|
39
|
-
}
|
40
|
-
};
|
41
|
-
theme = {
|
42
|
-
...prevTheme,
|
43
|
-
theme: themeProps
|
44
|
-
};
|
45
|
-
break;
|
46
|
-
case "ELEMENT_PROPS_CHANGE":
|
47
|
-
const prevEleProps = prev?.elementProps || {};
|
48
|
-
const prevEleValue = prevEleProps[fieldName] || {};
|
49
|
-
themeProps = {
|
50
|
-
...(prev || {}),
|
51
|
-
elementProps: {
|
52
|
-
...prevEleProps,
|
53
|
-
[fieldName]: {
|
54
|
-
...prevEleValue,
|
55
|
-
...update
|
56
|
-
}
|
57
|
-
}
|
58
|
-
};
|
59
|
-
theme = {
|
60
|
-
...prevTheme,
|
61
|
-
theme: themeProps
|
62
|
-
};
|
63
|
-
break;
|
64
|
-
case "OTHER_PROPS_CHANGE":
|
65
|
-
themeProps = {
|
66
|
-
...(prev || {}),
|
67
|
-
otherProps: {
|
68
|
-
...(prev.otherProps || {}),
|
69
|
-
...update
|
70
|
-
}
|
71
|
-
};
|
72
|
-
theme = {
|
73
|
-
...prevTheme,
|
74
|
-
theme: themeProps
|
75
|
-
};
|
76
|
-
break;
|
77
|
-
case "FONT_CHANGE":
|
78
|
-
const {
|
79
|
-
elementProps = {},
|
80
|
-
otherProps = {}
|
81
|
-
} = prev;
|
82
|
-
const {
|
83
|
-
fieldType
|
84
|
-
} = actionData || {};
|
85
|
-
const fields = MAP_FIELDS[fieldType];
|
86
|
-
const fontFieldsUpdate = {};
|
87
|
-
fields?.forEach(field => {
|
88
|
-
const prevFieldData = elementProps[field];
|
89
|
-
fontFieldsUpdate[field] = {
|
90
|
-
...prevFieldData,
|
91
|
-
...update
|
92
|
-
};
|
93
|
-
});
|
94
|
-
const FONT_KEY_FOR_FIELD = MAP_FONT_FIELD_KEYS[fieldType];
|
95
|
-
themeProps = {
|
96
|
-
...(prev || {}),
|
97
|
-
elementProps: {
|
98
|
-
...elementProps,
|
99
|
-
...fontFieldsUpdate
|
100
|
-
},
|
101
|
-
otherProps: {
|
102
|
-
...otherProps,
|
103
|
-
[FONT_KEY_FOR_FIELD]: update?.fontFamily
|
104
|
-
}
|
105
|
-
};
|
106
|
-
theme = {
|
107
|
-
...prevTheme,
|
108
|
-
theme: themeProps
|
109
|
-
};
|
110
|
-
break;
|
111
|
-
default:
|
112
|
-
theme = {
|
113
|
-
...prevTheme,
|
114
|
-
...(update || {})
|
115
|
-
};
|
116
|
-
break;
|
117
|
-
}
|
118
|
-
return theme;
|
119
|
-
}
|
120
|
-
const updateTheme = (editor, pageSt, update, actionData, triggerRender) => {
|
121
|
-
const {
|
122
|
-
pageProps
|
123
|
-
} = pageSt || {};
|
124
|
-
const {
|
125
|
-
theme
|
126
|
-
} = pageProps || {};
|
127
|
-
const updatedTheme = getUpdatePayload(theme, update, actionData);
|
128
|
-
updatePageSettings(editor, {
|
129
|
-
...(pageProps || {}),
|
130
|
-
theme: updatedTheme
|
131
|
-
});
|
132
|
-
triggerRender();
|
133
|
-
};
|
134
|
-
export const useEditorTheme = () => {
|
135
|
-
const editor = useSlate();
|
136
|
-
const {
|
137
|
-
triggerRender
|
138
|
-
} = useEditorContext();
|
139
|
-
const {
|
140
|
-
element: pageSt
|
141
|
-
} = getPageSettings(editor) || {};
|
142
|
-
const {
|
143
|
-
pageProps
|
144
|
-
} = pageSt || {};
|
145
|
-
const {
|
146
|
-
theme
|
147
|
-
} = pageProps || {};
|
148
|
-
return {
|
149
|
-
selectedTheme: theme?.theme || defaultTheme?.theme,
|
150
|
-
updateTheme: (update, actionData) => updateTheme(editor, pageSt, update, actionData, triggerRender),
|
151
|
-
theme
|
152
|
-
};
|
153
|
-
};
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from "react";
|
2
|
-
import { getElementProperty } from "../helper/theme";
|
3
|
-
import { ReactEditor } from "slate-react";
|
4
|
-
import { Node } from "slate";
|
5
|
-
import { useEditorTheme } from "./useEditorTheme";
|
6
|
-
function useThemeValues() {
|
7
|
-
return {};
|
8
|
-
}
|
9
|
-
export default useThemeValues;
|
10
|
-
export function useButtonStyle(value, key, element) {
|
11
|
-
const [buttonStyle, setButtonStyle] = useState(value);
|
12
|
-
const {
|
13
|
-
selectedTheme
|
14
|
-
} = useEditorTheme();
|
15
|
-
const themeBtnProps = selectedTheme?.elementProps?.button || {};
|
16
|
-
useEffect(() => {
|
17
|
-
const color = getColorValue(value, key, element, themeBtnProps);
|
18
|
-
setButtonStyle({
|
19
|
-
color
|
20
|
-
});
|
21
|
-
}, [value, key, element]);
|
22
|
-
return {
|
23
|
-
buttonStyle
|
24
|
-
};
|
25
|
-
}
|
26
|
-
const DEFAULT_MAP_THEMES = {
|
27
|
-
textColor: "color",
|
28
|
-
bgColor: "backgroundColor"
|
29
|
-
};
|
30
|
-
const hoverMap = (theme, format) => {
|
31
|
-
const hover = theme?.hover || {};
|
32
|
-
const key = DEFAULT_MAP_THEMES[format];
|
33
|
-
return hover[key];
|
34
|
-
};
|
35
|
-
const MAP_THEME_KEYS = {
|
36
|
-
...DEFAULT_MAP_THEMES,
|
37
|
-
textColorHover: hoverMap,
|
38
|
-
bgColorHover: hoverMap
|
39
|
-
};
|
40
|
-
const getColorValue = (val, key, elementProps, themeBtnProps) => {
|
41
|
-
const themeKey = MAP_THEME_KEYS[key];
|
42
|
-
if (elementProps?.type === "button" && !val && themeKey) {
|
43
|
-
if (typeof themeKey === "string") {
|
44
|
-
return themeBtnProps[themeKey];
|
45
|
-
} else {
|
46
|
-
return themeKey(themeBtnProps, key);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
return val;
|
50
|
-
};
|
51
|
-
export function getButtonElementStyle(editor, element, stylePropertyName) {
|
52
|
-
try {
|
53
|
-
const path = ReactEditor.findPath(editor, element);
|
54
|
-
if (path?.length) {
|
55
|
-
const currentEle = Node.get(editor, path);
|
56
|
-
const dom = ReactEditor.toDOMNode(editor, currentEle);
|
57
|
-
const editorBtn = dom?.querySelector(".button.theme-element");
|
58
|
-
return getElementProperty(editorBtn, stylePropertyName);
|
59
|
-
}
|
60
|
-
} catch (err) {
|
61
|
-
// console.log(err);
|
62
|
-
}
|
63
|
-
}
|