@flozy/editor 3.9.8 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +55 -45
- package/dist/Editor/CommonEditor.js +180 -111
- package/dist/Editor/Editor.css +9 -3
- package/dist/Editor/Elements/AI/AIInput.js +18 -24
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +66 -89
- package/dist/Editor/Elements/AI/Styles.js +2 -1
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +184 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/AI/helper.js +5 -3
- package/dist/Editor/Elements/Accordion/Accordion.js +74 -7
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +3 -2
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -60
- package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
- package/dist/Editor/Elements/Button/EditorButton.js +28 -16
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
- package/dist/Editor/Elements/Embed/Image.js +29 -21
- package/dist/Editor/Elements/Embed/Video.js +15 -11
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +33 -16
- package/dist/Editor/Elements/Grid/GridItem.js +3 -1
- package/dist/Editor/Elements/Link/Link.js +6 -1
- package/dist/Editor/Elements/Link/LinkButton.js +4 -2
- package/dist/Editor/Elements/Link/LinkPopup.js +10 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +8 -4
- package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +20 -5
- package/dist/Editor/Elements/Table/Styles.js +23 -1
- package/dist/Editor/Elements/Table/Table.js +3 -2
- package/dist/Editor/Elements/Table/TableCell.js +70 -8
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
- package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +1 -1
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -18
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +29 -3
- package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
- package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +40 -33
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -7
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -6
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
- package/dist/Editor/assets/svg/RedoIcon.js +27 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
- package/dist/Editor/assets/svg/TextIcon.js +8 -5
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/assets/svg/UndoIcon.js +27 -0
- package/dist/Editor/common/ColorPickerButton.js +25 -9
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
- package/dist/Editor/common/EditorCmds.js +35 -0
- package/dist/Editor/common/Icon.js +43 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
- package/dist/Editor/common/LinkSettings/index.js +4 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
- package/dist/Editor/common/LinkSettings/style.js +11 -8
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +5 -2
- package/dist/Editor/common/Section/index.js +57 -7
- package/dist/Editor/common/Section/styles.js +11 -0
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/iconslist.js +0 -31
- package/dist/Editor/helper/deserialize/index.js +14 -9
- package/dist/Editor/helper/theme.js +190 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -2
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +47 -5
- package/dist/Editor/plugins/withLayout.js +15 -10
- package/dist/Editor/plugins/withTable.js +2 -2
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
- package/dist/Editor/themeSettings/fonts/index.js +213 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
- package/dist/Editor/themeSettingsAI/style.js +247 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +161 -25
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +65 -6
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +74 -14
- package/dist/Editor/utils/table.js +51 -43
- package/package.json +3 -2
@@ -3,8 +3,13 @@ export const getNavOptions = (hideTools = []) => {
|
|
3
3
|
label: "None",
|
4
4
|
value: ""
|
5
5
|
}, {
|
6
|
-
label: "Trigger",
|
7
|
-
value: "
|
6
|
+
label: "Next Trigger",
|
7
|
+
value: "nextTrigger",
|
8
|
+
type: "next"
|
9
|
+
}, {
|
10
|
+
label: "Previous Trigger",
|
11
|
+
value: "prevTrigger",
|
12
|
+
type: "previous"
|
8
13
|
}, {
|
9
14
|
label: "Web Address",
|
10
15
|
value: "webAddress",
|
@@ -1,32 +1,35 @@
|
|
1
|
-
const ButtonNavSettingsStyles =
|
1
|
+
const ButtonNavSettingsStyles = themeType => ({
|
2
2
|
dialogContainer: {
|
3
|
-
|
3
|
+
"& .MuiPaper-root": {
|
4
|
+
background: themeType === "dark" ? "#141720 !important" : "#ffffff !important"
|
5
|
+
},
|
6
|
+
"& .MuiDialogContent-root": {
|
4
7
|
padding: "0px 20px"
|
5
8
|
},
|
6
|
-
|
9
|
+
"& .MuiDialogActions-root": {
|
7
10
|
padding: "10px"
|
8
11
|
},
|
9
|
-
|
12
|
+
"& .MuiTypography-h6": {
|
10
13
|
fontWeight: 600,
|
11
14
|
fontSize: "16px",
|
12
15
|
paddingRight: "20px"
|
13
16
|
},
|
14
17
|
"& .MuiGrid-container": {
|
15
|
-
marginTop:
|
18
|
+
marginTop: "0px"
|
16
19
|
},
|
17
20
|
"& .MuiGrid-item": {
|
18
21
|
padding: "14px"
|
19
22
|
}
|
20
23
|
},
|
21
24
|
saveBtn: {
|
22
|
-
color:
|
25
|
+
color: "#fff",
|
23
26
|
background: "#2563EB",
|
24
27
|
fontSize: "14px",
|
25
28
|
fontWeight: 500,
|
26
29
|
padding: "4px 24px",
|
27
30
|
textTransform: "none",
|
28
31
|
"&:hover": {
|
29
|
-
color:
|
32
|
+
color: "#fff",
|
30
33
|
background: "#2563EB"
|
31
34
|
}
|
32
35
|
},
|
@@ -43,7 +46,7 @@ const ButtonNavSettingsStyles = () => ({
|
|
43
46
|
}
|
44
47
|
},
|
45
48
|
closeIcon: {
|
46
|
-
position:
|
49
|
+
position: "absolute",
|
47
50
|
right: 8,
|
48
51
|
top: 8,
|
49
52
|
color: theme => theme.palette.grey[500]
|
@@ -39,7 +39,12 @@ const MentionsListCard = props => {
|
|
39
39
|
},
|
40
40
|
alt: name,
|
41
41
|
children: /*#__PURE__*/_jsx(Avatar, {
|
42
|
-
|
42
|
+
sx: {
|
43
|
+
background: 'linear-gradient(90deg, #5351FC 0%, #19A9FC 100%)'
|
44
|
+
},
|
45
|
+
alt: name,
|
46
|
+
src: avatar_filename,
|
47
|
+
children: !avatar_filename && name && name.charAt(0).toUpperCase()
|
43
48
|
})
|
44
49
|
}), /*#__PURE__*/_jsx(Box, {
|
45
50
|
sx: {
|
@@ -39,10 +39,13 @@ const usePopupStyles = theme => ({
|
|
39
39
|
color: theme?.palette?.editor?.textColor
|
40
40
|
},
|
41
41
|
"&.active": {
|
42
|
-
background:
|
42
|
+
background: `#2563EB2B`,
|
43
|
+
"& .MuiTypography-root": {
|
44
|
+
color: `${theme?.palette?.editor?.activeColor} !important`
|
45
|
+
}
|
43
46
|
},
|
44
47
|
"&:hover": {
|
45
|
-
background:
|
48
|
+
background: theme?.palette?.action?.hover || `#F4F4F4`
|
46
49
|
},
|
47
50
|
"&.renderComp": {
|
48
51
|
padding: "0px",
|
@@ -1,15 +1,17 @@
|
|
1
|
-
import React, { useState } from "react";
|
1
|
+
import React, { useRef, useState } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { ReactEditor, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, IconButton, Tooltip } from "@mui/material";
|
4
|
+
import { Box, IconButton, Popper, Tooltip } from "@mui/material";
|
5
5
|
import TuneIcon from "@mui/icons-material/Tune";
|
6
6
|
import SectionPopup from "../../Elements/Grid/SectionPopup";
|
7
7
|
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
8
8
|
import DragHandle from "../DnD/DragHandleButton";
|
9
9
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
10
10
|
import SectionStyle from "./styles";
|
11
|
+
import useWindowResize from "../../hooks/useWindowResize";
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
13
15
|
const list_types = ["orderedList", "unorderedList"];
|
14
16
|
const Section = props => {
|
15
17
|
const classes = SectionStyle();
|
@@ -38,14 +40,33 @@ const Section = props => {
|
|
38
40
|
flexDirection
|
39
41
|
} = sectionAlignment || {};
|
40
42
|
const path = ReactEditor.findPath(editor, element);
|
43
|
+
const anchorEl = useRef(null);
|
44
|
+
const popperEl = useRef(null);
|
45
|
+
const [size] = useWindowResize();
|
46
|
+
const isSectionFullWidth = sectionGridSize && sectionGridSize[size?.device] >= 12;
|
47
|
+
const [isHovering, setIsHovering] = useState(false);
|
48
|
+
const onMouseEnter = () => {
|
49
|
+
setIsHovering(true);
|
50
|
+
};
|
51
|
+
const onMouseLeave = () => {
|
52
|
+
setIsHovering(false);
|
53
|
+
};
|
41
54
|
const onSettings = () => {
|
42
55
|
setOpenSettings(true);
|
43
56
|
};
|
44
|
-
const Toolbar = (
|
57
|
+
const Toolbar = ({
|
58
|
+
fromPopper
|
59
|
+
}) => {
|
45
60
|
return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
|
46
61
|
component: "div",
|
47
62
|
className: `element-toolbar no-border-button hr section-tw sectionIcon`,
|
48
|
-
style: {
|
63
|
+
style: fromPopper ? {
|
64
|
+
position: "unset",
|
65
|
+
marginLeft: "28px",
|
66
|
+
paddingTop: "4px",
|
67
|
+
marginRight: "10px",
|
68
|
+
height: "100%"
|
69
|
+
} : {
|
49
70
|
left: "-28px",
|
50
71
|
top: "3px"
|
51
72
|
},
|
@@ -99,6 +120,8 @@ const Section = props => {
|
|
99
120
|
alignItems: horizantal,
|
100
121
|
justifyContent: vertical
|
101
122
|
},
|
123
|
+
onMouseEnter: onMouseEnter,
|
124
|
+
onMouseLeave: onMouseLeave,
|
102
125
|
children: [/*#__PURE__*/_jsxs(Box, {
|
103
126
|
className: "ed-section-inner",
|
104
127
|
sx: {
|
@@ -107,9 +130,36 @@ const Section = props => {
|
|
107
130
|
...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
|
108
131
|
}
|
109
132
|
},
|
110
|
-
|
111
|
-
|
112
|
-
|
133
|
+
ref: anchorEl,
|
134
|
+
children: [isHovering && isSectionFullWidth ? /*#__PURE__*/_jsx(Popper, {
|
135
|
+
open: isHovering && isSectionFullWidth,
|
136
|
+
anchorEl: anchorEl?.current,
|
137
|
+
placement: "top-start",
|
138
|
+
sx: {
|
139
|
+
zIndex: 9999
|
140
|
+
},
|
141
|
+
disablePortal: true,
|
142
|
+
ref: popperEl,
|
143
|
+
className: "sectionPopper",
|
144
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
145
|
+
sx: {
|
146
|
+
bgcolor: "background.paper",
|
147
|
+
background: "#F6F6F6",
|
148
|
+
height: "30px",
|
149
|
+
position: "relative"
|
150
|
+
},
|
151
|
+
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
152
|
+
...props,
|
153
|
+
fromPopper: true
|
154
|
+
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
155
|
+
fromPopper: true
|
156
|
+
})]
|
157
|
+
})
|
158
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
159
|
+
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
160
|
+
...props
|
161
|
+
}) : null, /*#__PURE__*/_jsx(Toolbar, {})]
|
162
|
+
}), children]
|
113
163
|
}), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
|
114
164
|
element: {
|
115
165
|
...element,
|
@@ -6,6 +6,9 @@ const SectionStyle = () => ({
|
|
6
6
|
},
|
7
7
|
"& .sectionIcon": {
|
8
8
|
opacity: 1
|
9
|
+
},
|
10
|
+
"& .sectionPopper": {
|
11
|
+
opacity: 1
|
9
12
|
}
|
10
13
|
},
|
11
14
|
"& .element-toolbar": {
|
@@ -13,6 +16,14 @@ const SectionStyle = () => ({
|
|
13
16
|
display: "block"
|
14
17
|
}
|
15
18
|
},
|
19
|
+
"& .sectionPopper": {
|
20
|
+
"&:hover": {
|
21
|
+
opacity: 1
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"& .sectionPopper": {
|
25
|
+
opacity: 0
|
26
|
+
},
|
16
27
|
"& .sectionIcon": {
|
17
28
|
opacity: 0,
|
18
29
|
padding: "0px",
|
@@ -40,6 +40,60 @@ const ELEMENTS_LIST = [{
|
|
40
40
|
icon: "headingThree"
|
41
41
|
}),
|
42
42
|
onInsert: editor => toggleBlock(editor, "headingThree", false)
|
43
|
+
}, {
|
44
|
+
name: "Heading 4",
|
45
|
+
desc: "",
|
46
|
+
group: "Text",
|
47
|
+
type: "headingFour",
|
48
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
49
|
+
icon: "headingFour"
|
50
|
+
}),
|
51
|
+
onInsert: editor => toggleBlock(editor, "headingFour", false)
|
52
|
+
}, {
|
53
|
+
name: "Heading 5",
|
54
|
+
desc: "",
|
55
|
+
group: "Text",
|
56
|
+
type: "headingFive",
|
57
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
58
|
+
icon: "headingFive"
|
59
|
+
}),
|
60
|
+
onInsert: editor => toggleBlock(editor, "headingFive", false)
|
61
|
+
}, {
|
62
|
+
name: "Heading 6",
|
63
|
+
desc: "",
|
64
|
+
group: "Text",
|
65
|
+
type: "headingSix",
|
66
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
67
|
+
icon: "headingSix"
|
68
|
+
}),
|
69
|
+
onInsert: editor => toggleBlock(editor, "headingSix", false)
|
70
|
+
}, {
|
71
|
+
name: "Paragraph 1",
|
72
|
+
desc: "",
|
73
|
+
group: "Text",
|
74
|
+
type: "paragraphOne",
|
75
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
76
|
+
icon: "paragraphOne"
|
77
|
+
}),
|
78
|
+
onInsert: editor => toggleBlock(editor, "paragraphOne", false)
|
79
|
+
}, {
|
80
|
+
name: "Paragraph 2",
|
81
|
+
desc: "",
|
82
|
+
group: "Text",
|
83
|
+
type: "paragraphTwo",
|
84
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
85
|
+
icon: "paragraphTwo"
|
86
|
+
}),
|
87
|
+
onInsert: editor => toggleBlock(editor, "paragraphTwo", false)
|
88
|
+
}, {
|
89
|
+
name: "Paragraph 3",
|
90
|
+
desc: "",
|
91
|
+
group: "Text",
|
92
|
+
type: "paragraphThree",
|
93
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
94
|
+
icon: "paragraphThree"
|
95
|
+
}),
|
96
|
+
onInsert: editor => toggleBlock(editor, "paragraphThree", false)
|
43
97
|
}, {
|
44
98
|
name: "Quote",
|
45
99
|
desc: "",
|
@@ -1,18 +1,18 @@
|
|
1
1
|
const accordionTitleBtnStyle = [{
|
2
2
|
tab: "Colors",
|
3
|
-
value: "
|
3
|
+
value: "accordionColor",
|
4
4
|
fields: [{
|
5
|
-
label: "
|
6
|
-
key: "
|
5
|
+
label: "Accordion Color",
|
6
|
+
key: "accordionTextColor",
|
7
7
|
type: "color",
|
8
8
|
needPreview: true
|
9
9
|
}, {
|
10
|
-
label: "Background Color",
|
11
|
-
key: "
|
10
|
+
label: "Accordion Background Color",
|
11
|
+
key: "accordionBgColor",
|
12
12
|
type: "color"
|
13
13
|
}, {
|
14
|
-
label: "Border Color",
|
15
|
-
key: "
|
14
|
+
label: "Accordion Border Color",
|
15
|
+
key: "accordionBorderColor",
|
16
16
|
type: "color"
|
17
17
|
}]
|
18
18
|
}];
|
@@ -1,20 +1,4 @@
|
|
1
1
|
const accordionTitleStyle = [{
|
2
|
-
tab: "Banner Spacing",
|
3
|
-
value: "bannerSpacing",
|
4
|
-
fields: [{
|
5
|
-
label: "Banner Spacing",
|
6
|
-
key: "bannerSpacing",
|
7
|
-
type: "bannerSpacing"
|
8
|
-
}]
|
9
|
-
}, {
|
10
|
-
tab: "Border Radius",
|
11
|
-
value: "borderRadius",
|
12
|
-
fields: [{
|
13
|
-
label: "Border Radius",
|
14
|
-
key: "borderRadius",
|
15
|
-
type: "borderRadius"
|
16
|
-
}]
|
17
|
-
}, {
|
18
2
|
tab: "Colors",
|
19
3
|
value: "colors",
|
20
4
|
fields: [{
|
@@ -31,5 +15,21 @@ const accordionTitleStyle = [{
|
|
31
15
|
key: "borderColor",
|
32
16
|
type: "color"
|
33
17
|
}]
|
18
|
+
}, {
|
19
|
+
tab: "Banner Spacing",
|
20
|
+
value: "bannerSpacing",
|
21
|
+
fields: [{
|
22
|
+
label: "Banner Spacing",
|
23
|
+
key: "bannerSpacing",
|
24
|
+
type: "bannerSpacing"
|
25
|
+
}]
|
26
|
+
}, {
|
27
|
+
tab: "Border Radius",
|
28
|
+
value: "borderRadius",
|
29
|
+
fields: [{
|
30
|
+
label: "Border Radius",
|
31
|
+
key: "borderRadius",
|
32
|
+
type: "borderRadius"
|
33
|
+
}]
|
34
34
|
}];
|
35
35
|
export default accordionTitleStyle;
|
@@ -20,7 +20,8 @@ const buttonStyle = [{
|
|
20
20
|
},
|
21
21
|
children: option.text
|
22
22
|
});
|
23
|
-
}
|
23
|
+
},
|
24
|
+
themeEnabled: true
|
24
25
|
}, {
|
25
26
|
label: "Font Size",
|
26
27
|
key: "textSize",
|
@@ -44,7 +45,8 @@ const buttonStyle = [{
|
|
44
45
|
}, {
|
45
46
|
label: "Button Color",
|
46
47
|
key: "bgColor",
|
47
|
-
type: "color"
|
48
|
+
type: "color",
|
49
|
+
themeEnabled: true
|
48
50
|
}, {
|
49
51
|
label: "Border Color",
|
50
52
|
key: "borderColor",
|
@@ -3,12 +3,12 @@ import { Checkbox, FormControlLabel, Grid, Slider, Typography, Box } from "@mui/
|
|
3
3
|
import { squreStyle } from "./radiusStyle";
|
4
4
|
import { getBreakPointsValue } from "../../../helper/theme";
|
5
5
|
import useWindowResize from "../../../hooks/useWindowResize";
|
6
|
+
import { useEditorTheme } from "../../../hooks/useEditorTheme";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const BANNER_SPACING_KEYS = ["top", "left", "right", "bottom"];
|
9
10
|
const BannerSpacing = props => {
|
10
11
|
const {
|
11
|
-
value: val,
|
12
12
|
data,
|
13
13
|
onChange,
|
14
14
|
elementProps,
|
@@ -18,11 +18,21 @@ const BannerSpacing = props => {
|
|
18
18
|
key
|
19
19
|
} = data;
|
20
20
|
const lockKeyVal = `lock${key}`;
|
21
|
-
|
21
|
+
const [size] = useWindowResize();
|
22
|
+
const {
|
23
|
+
selectedTheme
|
24
|
+
} = useEditorTheme();
|
25
|
+
const {
|
26
|
+
bannerSpacing,
|
27
|
+
lockbannerSpacing
|
28
|
+
} = selectedTheme?.elementProps?.button || {};
|
29
|
+
const isUserValue = Object.keys(props?.value || {})?.length;
|
30
|
+
const isUserLockedSpacing = typeof elementProps[lockKeyVal] === "boolean";
|
31
|
+
const val = isUserValue ? props?.value : bannerSpacing;
|
32
|
+
let lockSpacing = isUserLockedSpacing ? elementProps[lockKeyVal] : lockbannerSpacing;
|
22
33
|
if (lockSpacing === undefined) {
|
23
34
|
lockSpacing = true;
|
24
35
|
}
|
25
|
-
const [size] = useWindowResize();
|
26
36
|
const value = getBreakPointsValue(val, size?.device);
|
27
37
|
const handleChange = e => {
|
28
38
|
let changeAll = {};
|
@@ -3,27 +3,35 @@ import { Grid, Typography, Slider, FormControlLabel, Checkbox, Box } from "@mui/
|
|
3
3
|
import { radiusStyle } from "./radiusStyle";
|
4
4
|
import useWindowResize from "../../../hooks/useWindowResize";
|
5
5
|
import { getBreakPointsValue } from "../../../helper/theme";
|
6
|
+
import { useEditorTheme } from "../../../hooks/useEditorTheme";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const BORDER_RADIUS_KEYS = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
|
9
10
|
const BorderRadius = props => {
|
10
11
|
const {
|
11
|
-
value: val,
|
12
12
|
data,
|
13
13
|
onChange,
|
14
14
|
elementProps,
|
15
15
|
classes
|
16
16
|
} = props;
|
17
|
-
let {
|
18
|
-
lockRadius
|
19
|
-
} = elementProps;
|
20
|
-
if (lockRadius === undefined) {
|
21
|
-
lockRadius = true;
|
22
|
-
}
|
23
17
|
const {
|
24
18
|
key
|
25
19
|
} = data;
|
26
20
|
const [size] = useWindowResize();
|
21
|
+
const {
|
22
|
+
selectedTheme
|
23
|
+
} = useEditorTheme();
|
24
|
+
const {
|
25
|
+
borderRadius,
|
26
|
+
lockRadius: themeLockRadius
|
27
|
+
} = selectedTheme?.elementProps?.button || {};
|
28
|
+
const isUserValue = Object.keys(props?.value || {})?.length;
|
29
|
+
const isUserLockedRadius = typeof elementProps?.lockRadius === "boolean";
|
30
|
+
const val = isUserValue ? props?.value : borderRadius;
|
31
|
+
let lockRadius = isUserLockedRadius ? elementProps?.lockRadius : themeLockRadius;
|
32
|
+
if (lockRadius === undefined) {
|
33
|
+
lockRadius = true;
|
34
|
+
}
|
27
35
|
const value = getBreakPointsValue(val, size?.device);
|
28
36
|
const handleChange = e => {
|
29
37
|
let changeAll = {};
|
@@ -1,22 +1,44 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
2
2
|
import { Grid, TextField, InputAdornment, Typography } from "@mui/material";
|
3
3
|
import ColorPickerButton from "../../ColorPickerButton";
|
4
|
+
import { useSlateStatic } from "slate-react";
|
5
|
+
import { getElementStyle, getVariableValue } from "../../../helper/theme";
|
4
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
const MAP_STYLE_PROPS = {
|
9
|
+
bgColor: "background-color",
|
10
|
+
textColor: "color"
|
11
|
+
};
|
6
12
|
const Color = props => {
|
7
13
|
const {
|
8
|
-
value,
|
14
|
+
value: val,
|
9
15
|
data,
|
10
16
|
onChange,
|
11
|
-
classes
|
17
|
+
classes,
|
18
|
+
elementProps,
|
19
|
+
handleClose,
|
20
|
+
customProps
|
12
21
|
} = props;
|
13
22
|
const {
|
14
23
|
key,
|
15
24
|
label
|
16
25
|
} = data;
|
17
26
|
const [recentColors, setRecentColors] = useState({});
|
27
|
+
const editor = useSlateStatic();
|
28
|
+
const {
|
29
|
+
value,
|
30
|
+
inputValue
|
31
|
+
} = useMemo(() => {
|
32
|
+
const isVariable = val && val.startsWith("var");
|
33
|
+
const value = isVariable ? val : getElementStyle(editor, elementProps, MAP_STYLE_PROPS[key]);
|
34
|
+
const inputValue = isVariable ? getVariableValue(val) : getElementStyle(editor, elementProps, MAP_STYLE_PROPS[key]);
|
35
|
+
return {
|
36
|
+
value: value || val,
|
37
|
+
inputValue: inputValue || val
|
38
|
+
};
|
39
|
+
}, [editor, val]);
|
18
40
|
useEffect(() => {
|
19
|
-
const storedColors = JSON.parse(localStorage.getItem(
|
41
|
+
const storedColors = JSON.parse(localStorage.getItem("recentColors"));
|
20
42
|
if (storedColors) {
|
21
43
|
setRecentColors(storedColors);
|
22
44
|
}
|
@@ -39,7 +61,7 @@ const Color = props => {
|
|
39
61
|
[key]: updatedColors
|
40
62
|
};
|
41
63
|
setRecentColors(updatedColors);
|
42
|
-
localStorage.setItem(
|
64
|
+
localStorage.setItem("recentColors", JSON.stringify(updatedColors));
|
43
65
|
};
|
44
66
|
return /*#__PURE__*/_jsxs(Grid, {
|
45
67
|
item: true,
|
@@ -56,7 +78,7 @@ const Color = props => {
|
|
56
78
|
children: label
|
57
79
|
}), /*#__PURE__*/_jsx(TextField, {
|
58
80
|
fullWidth: true,
|
59
|
-
value:
|
81
|
+
value: inputValue,
|
60
82
|
placeholder: `${label} color code`,
|
61
83
|
InputLabelProps: {
|
62
84
|
shrink: true
|
@@ -68,7 +90,9 @@ const Color = props => {
|
|
68
90
|
classes: classes,
|
69
91
|
value: value,
|
70
92
|
onSave: onSave,
|
71
|
-
recentColors: recentColors[key]
|
93
|
+
recentColors: recentColors[key],
|
94
|
+
handleClose: handleClose,
|
95
|
+
disableEditTheme: customProps?.disableEditTheme
|
72
96
|
})
|
73
97
|
})
|
74
98
|
}
|
@@ -1,19 +1,26 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useMemo } from "react";
|
2
2
|
import { TextField, IconButton, Grid, Typography } from "@mui/material";
|
3
3
|
import { sizeMap } from "../../../utils/font.js";
|
4
4
|
import { TextMinusIcon, TextPlusIcon } from "../../../common/iconslist.js";
|
5
|
+
import { getElementStyle } from "../../../helper/theme.js";
|
6
|
+
import { useSlateStatic } from "slate-react";
|
5
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
9
|
const FontSize = props => {
|
8
10
|
const {
|
9
|
-
value,
|
11
|
+
value: val,
|
10
12
|
data,
|
11
|
-
onChange
|
13
|
+
onChange,
|
14
|
+
elementProps
|
12
15
|
} = props;
|
13
16
|
const {
|
14
17
|
key,
|
15
18
|
width
|
16
19
|
} = data;
|
20
|
+
const editor = useSlateStatic();
|
21
|
+
const value = useMemo(() => {
|
22
|
+
return getElementStyle(editor, elementProps, "font-size") || val;
|
23
|
+
}, [editor, val]);
|
17
24
|
const handleChange = e => {
|
18
25
|
let inc = parseInt(e.target.value) || 16;
|
19
26
|
inc = inc > 200 ? 200 : inc;
|
@@ -24,7 +31,9 @@ const FontSize = props => {
|
|
24
31
|
const getSizeVal = () => {
|
25
32
|
try {
|
26
33
|
const size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
27
|
-
|
34
|
+
const defaultSize = 16;
|
35
|
+
const val = parseInt(size || defaultSize);
|
36
|
+
return isNaN(val) ? defaultSize : val;
|
28
37
|
} catch (err) {
|
29
38
|
return "";
|
30
39
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
2
2
|
import { Grid, Checkbox, FormControlLabel, FormHelperText } from "@mui/material";
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -6,12 +6,23 @@ const SelectBox = props => {
|
|
6
6
|
const {
|
7
7
|
value,
|
8
8
|
data,
|
9
|
-
onChange
|
9
|
+
onChange,
|
10
|
+
elementProps
|
10
11
|
} = props;
|
11
12
|
const {
|
12
13
|
key,
|
13
14
|
placeholder
|
14
15
|
} = data;
|
16
|
+
const [checkedValue, setCheckedValue] = useState(false);
|
17
|
+
const isFirstRender = useRef(true);
|
18
|
+
useEffect(() => {
|
19
|
+
if (isFirstRender.current && elementProps.element === "email" && value === undefined) {
|
20
|
+
setCheckedValue(true);
|
21
|
+
isFirstRender.current = false;
|
22
|
+
} else {
|
23
|
+
setCheckedValue(value);
|
24
|
+
}
|
25
|
+
}, [elementProps.element, value]);
|
15
26
|
const handleChange = e => {
|
16
27
|
onChange({
|
17
28
|
[key]: e.target.checked
|
@@ -26,7 +37,7 @@ const SelectBox = props => {
|
|
26
37
|
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
27
38
|
control: /*#__PURE__*/_jsx(Checkbox, {
|
28
39
|
value: value,
|
29
|
-
checked:
|
40
|
+
checked: checkedValue,
|
30
41
|
onChange: handleChange
|
31
42
|
}),
|
32
43
|
label: placeholder
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useMemo } from "react";
|
2
2
|
import { FormControl, Grid, ListItemIcon, ListSubheader, MenuItem, Select, Typography } from "@mui/material";
|
3
|
-
import { getBreakPointsValue } from "../../../helper/theme";
|
3
|
+
import { getBreakPointsValue, getElementStyle } from "../../../helper/theme";
|
4
4
|
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
+
import { useSlateStatic } from "slate-react";
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
8
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -22,10 +23,19 @@ const TextOptions = props => {
|
|
22
23
|
isBreakpoint,
|
23
24
|
options,
|
24
25
|
renderOption,
|
25
|
-
width
|
26
|
+
width,
|
27
|
+
themeEnabled
|
26
28
|
} = data;
|
27
29
|
const [size] = useWindowResize();
|
28
|
-
const
|
30
|
+
const editor = useSlateStatic();
|
31
|
+
const value = useMemo(() => {
|
32
|
+
const userValue = isBreakpoint ? getBreakPointsValue(val, size?.device) : val;
|
33
|
+
if (themeEnabled) {
|
34
|
+
// editor takes a little amount of time to update the new style in element, in that case userValue will be returned
|
35
|
+
return getElementStyle(editor, elementProps, key) || userValue;
|
36
|
+
}
|
37
|
+
return userValue;
|
38
|
+
}, [editor, isBreakpoint, val, size?.device]);
|
29
39
|
const metaDataMappingOptions = metaMappings?.boards || [];
|
30
40
|
const updatedOption = elementProps?.metadatamapping ? [...options, ...metaDataMappingOptions] : options;
|
31
41
|
const handleChange = (e, d) => {
|