@flozy/editor 3.7.1 → 3.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +211 -0
- package/dist/Editor/CommonEditor.js +169 -111
- 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 +34 -18
- package/dist/Editor/Elements/ChipText/ChipText.js +3 -3
- 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/Frames/ImageFrame.js +1 -0
- package/dist/Editor/Elements/Embed/Image.js +28 -20
- package/dist/Editor/Elements/Embed/Video.js +15 -11
- package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -2
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +16 -0
- 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 +3 -1
- package/dist/Editor/Elements/Grid/GridItem.js +4 -2
- package/dist/Editor/Elements/InlineIcon/InlineIcon.js +2 -3
- 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 +11 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/List/CheckList.js +6 -2
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +3 -2
- 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 +5 -11
- 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 +20 -13
- 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 +9 -2
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -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 +1 -1
- package/dist/Editor/common/EditorCmds.js +35 -0
- package/dist/Editor/common/Icon.js +30 -2
- package/dist/Editor/common/MUIIcon/index.js +48 -0
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +5 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +6 -3
- 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/color.js +31 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +12 -28
- package/dist/Editor/common/StyleBuilder/fieldTypes/loadIcon.js +13 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/mui_filled_icons.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/formStyle.js +25 -26
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/helper/index.js +15 -0
- package/dist/Editor/helper/theme.js +190 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +15 -6
- 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 +157 -25
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +361 -0
- package/dist/Editor/utils/events.js +11 -4
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/form.js +2 -2
- package/dist/Editor/utils/helper.js +71 -12
- package/dist/Editor/utils/serializeToHTML.js +25 -13
- package/dist/index.js +5 -1
- package/package.json +4 -4
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import StyleBuilder from "../../common/StyleBuilder";
|
3
3
|
import accordionTitleBtnStyle from "../../common/StyleBuilder/accordionTitleBtnStyle";
|
4
|
+
import accordionTitleStyle from "../../common/StyleBuilder/accordionTitleStyle";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
const AccordionBtnPopup = props => {
|
6
7
|
const {
|
@@ -10,12 +11,12 @@ const AccordionBtnPopup = props => {
|
|
10
11
|
customProps
|
11
12
|
} = props;
|
12
13
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
13
|
-
title: "Accordion
|
14
|
+
title: "Accordion Settings",
|
14
15
|
type: "accordionTitleBtnStyle",
|
15
16
|
element: element,
|
16
17
|
onSave: onSave,
|
17
18
|
onClose: onClose,
|
18
|
-
renderTabs: accordionTitleBtnStyle,
|
19
|
+
renderTabs: [...accordionTitleBtnStyle, ...accordionTitleStyle],
|
19
20
|
customProps: customProps
|
20
21
|
});
|
21
22
|
};
|
@@ -1,68 +1,17 @@
|
|
1
|
-
import React
|
2
|
-
import { Transforms } from "slate";
|
3
|
-
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
4
|
-
import AccordionTitlePopup from "./AccordionTitlePopup";
|
5
|
-
import { IconButton, Tooltip } from "@mui/material";
|
6
|
-
import { GridSettingsIcon } from "../../common/iconslist";
|
7
|
-
import { useEditorSelection } from "../../hooks/useMouseMove";
|
1
|
+
import React from "react";
|
8
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
3
|
const AccordionSummary = props => {
|
11
4
|
const {
|
12
5
|
attributes,
|
13
6
|
children,
|
14
|
-
element
|
15
|
-
customProps
|
7
|
+
element
|
16
8
|
} = props;
|
17
|
-
const {
|
18
|
-
readOnly
|
19
|
-
} = customProps;
|
20
|
-
const [openSetttings, setOpenSettings] = useState(false);
|
21
|
-
const editor = useSlateStatic();
|
22
|
-
const [showTool] = useEditorSelection(editor);
|
23
|
-
const selected = useSelected();
|
24
|
-
const path = ReactEditor.findPath(editor, element);
|
25
9
|
const {
|
26
10
|
textColor,
|
27
11
|
bgColor,
|
28
12
|
borderColor
|
29
13
|
} = element;
|
30
|
-
|
31
|
-
return selected && !showTool ? /*#__PURE__*/_jsx("div", {
|
32
|
-
className: "element-toolbar hr",
|
33
|
-
contentEditable: false,
|
34
|
-
style: {
|
35
|
-
top: "-42px"
|
36
|
-
},
|
37
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
38
|
-
title: "Settings",
|
39
|
-
arrow: true,
|
40
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
41
|
-
onClick: onSettings,
|
42
|
-
children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
|
43
|
-
})
|
44
|
-
})
|
45
|
-
}) : null;
|
46
|
-
};
|
47
|
-
const onSettings = () => {
|
48
|
-
setOpenSettings(true);
|
49
|
-
};
|
50
|
-
const onSave = data => {
|
51
|
-
const updateData = {
|
52
|
-
...data
|
53
|
-
};
|
54
|
-
delete updateData.children;
|
55
|
-
Transforms.setNodes(editor, {
|
56
|
-
...updateData
|
57
|
-
}, {
|
58
|
-
at: path
|
59
|
-
});
|
60
|
-
onClose();
|
61
|
-
};
|
62
|
-
const onClose = () => {
|
63
|
-
setOpenSettings(false);
|
64
|
-
};
|
65
|
-
return /*#__PURE__*/_jsxs("div", {
|
14
|
+
return /*#__PURE__*/_jsx("div", {
|
66
15
|
className: `accordion-summary-container`,
|
67
16
|
...attributes,
|
68
17
|
style: {
|
@@ -72,12 +21,7 @@ const AccordionSummary = props => {
|
|
72
21
|
border: `1px solid ${borderColor}`,
|
73
22
|
color: textColor
|
74
23
|
},
|
75
|
-
children:
|
76
|
-
element: element,
|
77
|
-
onSave: onSave,
|
78
|
-
onClose: onClose,
|
79
|
-
customProps: customProps
|
80
|
-
}) : null]
|
24
|
+
children: children
|
81
25
|
});
|
82
26
|
};
|
83
27
|
export default AccordionSummary;
|
@@ -62,6 +62,11 @@ function AppHeader(props) {
|
|
62
62
|
const handleDrawerToggle = () => {
|
63
63
|
setMobileOpen(prevState => !prevState);
|
64
64
|
};
|
65
|
+
const closeDrawer = () => {
|
66
|
+
if (mobileOpen) {
|
67
|
+
handleDrawerToggle();
|
68
|
+
}
|
69
|
+
};
|
65
70
|
const onSettings = e => {
|
66
71
|
if (!readOnly) {
|
67
72
|
e.stopPropagation();
|
@@ -148,10 +153,27 @@ function AppHeader(props) {
|
|
148
153
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
|
149
154
|
children: menus.map((item, i) => {
|
150
155
|
const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
|
156
|
+
const onTouchEnd = e => {
|
157
|
+
if (buttonProps?.onTouchEnd) {
|
158
|
+
buttonProps?.onTouchEnd(e);
|
159
|
+
closeDrawer();
|
160
|
+
}
|
161
|
+
};
|
162
|
+
const onClick = e => {
|
163
|
+
if (buttonProps?.onClick) {
|
164
|
+
buttonProps?.onClick(e);
|
165
|
+
closeDrawer();
|
166
|
+
}
|
167
|
+
};
|
168
|
+
const props = {
|
169
|
+
...buttonProps,
|
170
|
+
onTouchEnd,
|
171
|
+
onClick
|
172
|
+
};
|
151
173
|
return /*#__PURE__*/_jsx(ListItem, {
|
152
174
|
disablePadding: true,
|
153
175
|
children: /*#__PURE__*/_jsx(ListItemButton, {
|
154
|
-
...
|
176
|
+
...props,
|
155
177
|
sx: {
|
156
178
|
textAlign: "center"
|
157
179
|
},
|
@@ -229,7 +251,7 @@ function AppHeader(props) {
|
|
229
251
|
style: {
|
230
252
|
display: "inline-flex",
|
231
253
|
alignItems: "center",
|
232
|
-
color: textColor,
|
254
|
+
color: textColor || "#000000",
|
233
255
|
fontSize: logoFontSize,
|
234
256
|
fontFamily: titleFontFamily,
|
235
257
|
justifyContent: isLogoRight ? "end" : "start"
|
@@ -277,7 +299,7 @@ function AppHeader(props) {
|
|
277
299
|
fontFamily: fontFamily,
|
278
300
|
textTransform: "none",
|
279
301
|
fontSize: fontSize || "16px",
|
280
|
-
color: textColor || "#
|
302
|
+
color: textColor || "#000",
|
281
303
|
background: bgColor || "none",
|
282
304
|
"& .m-settings": {
|
283
305
|
display: "none",
|
@@ -292,7 +314,7 @@ function AppHeader(props) {
|
|
292
314
|
background: "#FFF"
|
293
315
|
},
|
294
316
|
"&:hover": {
|
295
|
-
color: textColorHover || textColor || "#
|
317
|
+
color: textColorHover || textColor || "#000",
|
296
318
|
background: bgColorHover || bgColor || "none",
|
297
319
|
"& .m-settings": {
|
298
320
|
display: "block"
|
@@ -2,7 +2,8 @@ import React, { useState } from "react";
|
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { ReactEditor, useSlateStatic } from "slate-react";
|
4
4
|
import { IconButton, Tooltip, Box } from "@mui/material";
|
5
|
-
import * as fIcons from "@mui/icons-material";
|
5
|
+
// import * as fIcons from "@mui/icons-material";
|
6
|
+
import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
|
6
7
|
import SettingsIcon from "@mui/icons-material/Settings";
|
7
8
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
8
9
|
import LinkIcon from "@mui/icons-material/Link";
|
@@ -12,6 +13,9 @@ import { WorkflowIcon } from "../../common/iconslist";
|
|
12
13
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
13
14
|
import { handleLinkType, windowVar } from "../../utils/helper";
|
14
15
|
import LinkSettings from "../../common/LinkSettings";
|
16
|
+
import { useEditorTheme } from "../../hooks/useEditorTheme";
|
17
|
+
import { getTheme } from "../../theme";
|
18
|
+
import { fontFamilyMap } from "../../utils/font";
|
15
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
16
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
17
21
|
const EditorButton = props => {
|
@@ -29,6 +33,12 @@ const EditorButton = props => {
|
|
29
33
|
const path = ReactEditor.findPath(editor, element);
|
30
34
|
const [edit, setEdit] = useState(false);
|
31
35
|
const [openNav, setOpenNav] = useState(false);
|
36
|
+
const {
|
37
|
+
theme
|
38
|
+
} = useEditorTheme();
|
39
|
+
const {
|
40
|
+
buttonTheme
|
41
|
+
} = getTheme(theme);
|
32
42
|
const {
|
33
43
|
label,
|
34
44
|
bgColor,
|
@@ -42,7 +52,7 @@ const EditorButton = props => {
|
|
42
52
|
fontFamily,
|
43
53
|
textColorHover,
|
44
54
|
bgColorHover,
|
45
|
-
buttonIcon,
|
55
|
+
// buttonIcon,
|
46
56
|
iconPosition = "start",
|
47
57
|
borderStyle,
|
48
58
|
borderWidth,
|
@@ -63,7 +73,8 @@ const EditorButton = props => {
|
|
63
73
|
};
|
64
74
|
const isTrigger = linkType === "actionTrigger";
|
65
75
|
const refURl = isTrigger ? buttonLink?.url : url;
|
66
|
-
const
|
76
|
+
const buttonIcon = element?.buttonIcon || buttonTheme?.buttonIcon;
|
77
|
+
const BtnIcon = buttonIcon ? buttonIcon : null;
|
67
78
|
windowVar.lastButtonProps = element;
|
68
79
|
const handleTrigger = async () => {
|
69
80
|
if (metadata?.buttonLink?.handler) {
|
@@ -80,6 +91,7 @@ const EditorButton = props => {
|
|
80
91
|
}
|
81
92
|
};
|
82
93
|
const buttonProps = handleLinkType(refURl, linkType, readOnly, openInNewTab, handleTrigger);
|
94
|
+
console.log(openInNewTab);
|
83
95
|
const onMenuClick = val => () => {
|
84
96
|
switch (val) {
|
85
97
|
case "edit":
|
@@ -131,6 +143,7 @@ const EditorButton = props => {
|
|
131
143
|
color: "rgba(0, 0, 0, 0.54)"
|
132
144
|
},
|
133
145
|
...btnProps,
|
146
|
+
target: openInNewTab ? "_blank" : "_self",
|
134
147
|
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
135
148
|
})
|
136
149
|
})]
|
@@ -183,20 +196,9 @@ const EditorButton = props => {
|
|
183
196
|
children: [/*#__PURE__*/_jsxs(Box, {
|
184
197
|
sx: {
|
185
198
|
textDecoration: "none",
|
186
|
-
background: bgColor || "rgb(30, 75, 122)",
|
187
199
|
borderBlockStyle: "solid",
|
188
|
-
borderColor: borderColor || "transparent",
|
189
200
|
borderWidth: borderWidth !== undefined ? borderWidth : borderColor ? "1px" : "0px",
|
190
|
-
borderRadius: {
|
191
|
-
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
192
|
-
},
|
193
201
|
borderStyle: borderStyle || "solid",
|
194
|
-
padding: {
|
195
|
-
...getTRBLBreakPoints(bannerSpacing)
|
196
|
-
},
|
197
|
-
color: `${textColor || "#FFFFFF"}`,
|
198
|
-
fontSize: textSize || "inherit",
|
199
|
-
fontFamily: fontFamily || "PoppinsRegular",
|
200
202
|
display: "inline-flex",
|
201
203
|
alignItems: "center",
|
202
204
|
position: "relative",
|
@@ -204,20 +206,34 @@ const EditorButton = props => {
|
|
204
206
|
display: "none"
|
205
207
|
},
|
206
208
|
"&:hover": {
|
207
|
-
color: `${textColorHover || textColor
|
208
|
-
background: bgColorHover || bgColor
|
209
|
+
color: `${textColorHover || textColor}`,
|
210
|
+
background: bgColorHover || bgColor,
|
209
211
|
"& .element-toolbar": {
|
210
212
|
display: "flex"
|
211
213
|
}
|
214
|
+
},
|
215
|
+
color: `${textColor} !important`,
|
216
|
+
fontSize: `${textSize}px !important`,
|
217
|
+
fontFamily: `${fontFamilyMap[fontFamily] || ""} !important`,
|
218
|
+
background: `${bgColor} !important`,
|
219
|
+
borderColor: `${borderColor} !important`,
|
220
|
+
borderRadius: {
|
221
|
+
...getBreakPointsValue(borderRadius || buttonTheme?.borderRadius || {}, null, "overrideBorderRadius", true)
|
222
|
+
},
|
223
|
+
padding: {
|
224
|
+
...getTRBLBreakPoints(bannerSpacing || buttonTheme?.bannerSpacing || {})
|
212
225
|
}
|
213
226
|
},
|
214
227
|
...buttonProps,
|
215
|
-
|
228
|
+
className: "button theme-element",
|
229
|
+
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
|
230
|
+
iconName: buttonIcon,
|
216
231
|
style: {
|
217
232
|
paddingLeft: "4px",
|
218
233
|
paddingRight: "4px"
|
219
234
|
}
|
220
|
-
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(
|
235
|
+
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(MUIIcon, {
|
236
|
+
iconName: buttonIcon,
|
221
237
|
style: {
|
222
238
|
paddingLeft: "4px",
|
223
239
|
paddingRight: "4px"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
4
|
-
import * as fIcons from "@mui/icons-material";
|
5
4
|
import { Box } from "@mui/material";
|
6
5
|
import ChipTextPopup from "./ChipTextPopup";
|
7
6
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
7
|
+
import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const ChipText = props => {
|
@@ -26,7 +26,6 @@ const ChipText = props => {
|
|
26
26
|
buttonIcon,
|
27
27
|
textSize
|
28
28
|
} = element;
|
29
|
-
const BtnIcon = buttonIcon ? fIcons[buttonIcon] : fIcons["Check"];
|
30
29
|
const [openSetttings, setOpenSettings] = useState(false);
|
31
30
|
const editor = useSlateStatic();
|
32
31
|
const path = ReactEditor.findPath(editor, element);
|
@@ -82,7 +81,8 @@ const ChipText = props => {
|
|
82
81
|
background: bgColor || "#CCC",
|
83
82
|
color: textColor
|
84
83
|
},
|
85
|
-
children: [/*#__PURE__*/_jsx(
|
84
|
+
children: [/*#__PURE__*/_jsx(MUIIcon, {
|
85
|
+
iconName: buttonIcon || "Check",
|
86
86
|
style: {
|
87
87
|
fontSize: textSize || "16px",
|
88
88
|
lineHeight: textSize || "16px",
|
@@ -1,11 +1,15 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Box, IconButton, Popover } from "@mui/material";
|
1
|
+
import React, { useContext, useState } from "react";
|
2
|
+
import { Box, IconButton, Popover, Typography, useTheme } from "@mui/material";
|
3
3
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
4
4
|
import Button from "../../common/Button";
|
5
5
|
import { colors } from "./defaultColors";
|
6
6
|
import ColorPicker from "./colorPicker.svg";
|
7
|
+
import { ThemeContext } from "../../CommonEditor";
|
8
|
+
import { useSlateStatic } from "slate-react";
|
9
|
+
import { Transforms } from "slate";
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
13
|
let c = [];
|
10
14
|
const ColorChunks = (recentColors = []) => [...recentColors, ...colors].reduce((a, b, i) => {
|
11
15
|
if (i % 7 === 0) {
|
@@ -31,9 +35,7 @@ const SingleColorButton = ({
|
|
31
35
|
style: {
|
32
36
|
width: "100%",
|
33
37
|
display: "flex",
|
34
|
-
|
35
|
-
padding: padding || "8px",
|
36
|
-
justifyContent: "center"
|
38
|
+
padding: padding || "8px"
|
37
39
|
},
|
38
40
|
children: [crs.map(m => /*#__PURE__*/_jsx(Button, {
|
39
41
|
onClick: handleSelect(m),
|
@@ -109,11 +111,17 @@ const ColorButtons = props => {
|
|
109
111
|
forMiniTool,
|
110
112
|
openColorTool,
|
111
113
|
onClose,
|
112
|
-
onColorPickerClick
|
114
|
+
onColorPickerClick,
|
115
|
+
disableEditTheme
|
113
116
|
} = props;
|
114
117
|
const [row1, ...restRows] = ColorChunks([]);
|
115
118
|
const [anchorEl, setAnchorEl] = useState(null);
|
116
119
|
const open = Boolean(anchorEl);
|
120
|
+
const theme = useTheme();
|
121
|
+
const editor = useSlateStatic();
|
122
|
+
const {
|
123
|
+
setOpenTheme
|
124
|
+
} = useContext(ThemeContext);
|
117
125
|
const handleMore = e => {
|
118
126
|
setAnchorEl(e.currentTarget);
|
119
127
|
};
|
@@ -126,6 +134,7 @@ const ColorButtons = props => {
|
|
126
134
|
const handleSelect = color => () => {
|
127
135
|
onSelect(color);
|
128
136
|
};
|
137
|
+
const colorVars = theme?.vars?.colors || {};
|
129
138
|
return /*#__PURE__*/_jsxs(Box, {
|
130
139
|
component: "span",
|
131
140
|
sx: classes.colorButtons,
|
@@ -142,7 +151,7 @@ const ColorButtons = props => {
|
|
142
151
|
activeColor: activeColor
|
143
152
|
}, `si_btn_row1_${m}_${i}`);
|
144
153
|
})
|
145
|
-
}), /*#__PURE__*/
|
154
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
146
155
|
open: open || openColorTool,
|
147
156
|
anchorEl: anchorEl || openColorTool,
|
148
157
|
onClose: handleClose,
|
@@ -156,9 +165,39 @@ const ColorButtons = props => {
|
|
156
165
|
},
|
157
166
|
sx: classes.colorPopper,
|
158
167
|
className: "colorPopper",
|
159
|
-
children:
|
168
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
160
169
|
sx: classes.colorButtonsInner,
|
161
|
-
children:
|
170
|
+
children: [Object.values(colorVars)?.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
171
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
172
|
+
component: "div",
|
173
|
+
className: "singleColorTitleWrapper",
|
174
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
175
|
+
variant: "subtitle2",
|
176
|
+
children: "Theme colour"
|
177
|
+
}), disableEditTheme ? null : /*#__PURE__*/_jsx("div", {
|
178
|
+
className: "editBtn",
|
179
|
+
onClick: () => {
|
180
|
+
Transforms.deselect(editor, {
|
181
|
+
at: editor.selection
|
182
|
+
});
|
183
|
+
setOpenTheme("editThemeColor");
|
184
|
+
},
|
185
|
+
children: "Edit"
|
186
|
+
})]
|
187
|
+
}), /*#__PURE__*/_jsx(SingleColorButton, {
|
188
|
+
crs: Object.values(colorVars),
|
189
|
+
handleSelect: handleSelect,
|
190
|
+
classes: classes,
|
191
|
+
activeColor: activeColor
|
192
|
+
})]
|
193
|
+
}) : null, /*#__PURE__*/_jsx(Box, {
|
194
|
+
component: "div",
|
195
|
+
className: "singleColorTitleWrapper",
|
196
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
197
|
+
variant: "subtitle2",
|
198
|
+
children: "Custom colour"
|
199
|
+
})
|
200
|
+
}), restRows.map((m, i) => {
|
162
201
|
return /*#__PURE__*/_jsx(SingleColorButton, {
|
163
202
|
id: `p2_${id}`,
|
164
203
|
crs: m,
|
@@ -167,14 +206,18 @@ const ColorButtons = props => {
|
|
167
206
|
classes: classes,
|
168
207
|
activeColor: activeColor
|
169
208
|
}, `si_btn_${m}_${i}`);
|
170
|
-
})
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
209
|
+
}), forMiniTool ? /*#__PURE__*/_jsx(IconButton, {
|
210
|
+
onClick: onColorPickerClick,
|
211
|
+
style: {
|
212
|
+
alignSelf: "start",
|
213
|
+
margin: "6px"
|
214
|
+
},
|
215
|
+
children: /*#__PURE__*/_jsx("img", {
|
216
|
+
src: ColorPicker,
|
217
|
+
alt: "color wheel"
|
218
|
+
})
|
219
|
+
}) : null]
|
220
|
+
})
|
178
221
|
})]
|
179
222
|
});
|
180
223
|
};
|
@@ -60,4 +60,28 @@
|
|
60
60
|
padding: 0 15px !important;
|
61
61
|
width: 60px !important;
|
62
62
|
flex-shrink: 0;
|
63
|
-
}
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
.singleColorTitleWrapper {
|
67
|
+
display: flex;
|
68
|
+
justify-content: space-between;
|
69
|
+
align-items: center;
|
70
|
+
padding: 10px;
|
71
|
+
width: 100%;
|
72
|
+
border-bottom: 1px solid #DCE4EC;
|
73
|
+
}
|
74
|
+
|
75
|
+
.singleColorTitleWrapper .MuiTypography-root {
|
76
|
+
font-weight: 600;
|
77
|
+
}
|
78
|
+
|
79
|
+
.singleColorTitleWrapper .editBtn {
|
80
|
+
text-transform: none;
|
81
|
+
color: #2563EB;
|
82
|
+
text-decoration: underline;
|
83
|
+
padding: 0px;
|
84
|
+
min-width: unset;
|
85
|
+
cursor: pointer;
|
86
|
+
font-size: 14px;
|
87
|
+
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
3
|
import { Transforms } from "slate";
|
4
|
-
import ColorPickerTool from "react-gcolor-picker";
|
5
4
|
import { IconButton, Tooltip, Box, Popover } from "@mui/material";
|
6
5
|
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions";
|
7
6
|
import ColorButtons from "./ColorButtons";
|
@@ -9,6 +8,7 @@ import ColorPickerStyles from "./Styles";
|
|
9
8
|
import colorWheel from "./colorWheel.png";
|
10
9
|
import "./ColorPicker.css";
|
11
10
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
11
|
+
import CustomColorPicker from "../../common/CustomColorPicker";
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -95,10 +95,10 @@ const ColorPicker = props => {
|
|
95
95
|
horizontal: "top"
|
96
96
|
},
|
97
97
|
sx: classes.colorPickerPopup,
|
98
|
-
children: /*#__PURE__*/_jsx(
|
98
|
+
children: /*#__PURE__*/_jsx(CustomColorPicker, {
|
99
99
|
gradient: true,
|
100
|
-
|
101
|
-
|
100
|
+
onChange: handleFormSubmit,
|
101
|
+
color: activeColor
|
102
102
|
})
|
103
103
|
})]
|
104
104
|
});
|
@@ -15,7 +15,8 @@ const ColorPickerStyles = theme => ({
|
|
15
15
|
colorPopper: {
|
16
16
|
"& .MuiPaper-root": {
|
17
17
|
backgroundColor: theme?.palette?.editor?.background,
|
18
|
-
|
18
|
+
padding: "4px 14px",
|
19
|
+
"@media only screen and (max-width: 600px)": {
|
19
20
|
marginTop: "-40px"
|
20
21
|
}
|
21
22
|
}
|
@@ -167,15 +167,19 @@ const Image = ({
|
|
167
167
|
onTouchEnd
|
168
168
|
} = handleLinkType(webAddress, linkType, readOnly, isNewTab);
|
169
169
|
const handleImageClick = () => {
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
onClick
|
176
|
-
|
177
|
-
|
178
|
-
onTouchEnd
|
170
|
+
try {
|
171
|
+
Transforms.select(editor, {
|
172
|
+
anchor: Editor.start(editor, path),
|
173
|
+
focus: Editor.end(editor, path)
|
174
|
+
});
|
175
|
+
if (onClick) {
|
176
|
+
onClick();
|
177
|
+
}
|
178
|
+
if (onTouchEnd) {
|
179
|
+
onTouchEnd();
|
180
|
+
}
|
181
|
+
} catch (err) {
|
182
|
+
console.log(err);
|
179
183
|
}
|
180
184
|
};
|
181
185
|
useEffect(() => {
|
@@ -189,16 +193,20 @@ const Image = ({
|
|
189
193
|
setOpenSettings(true);
|
190
194
|
};
|
191
195
|
const onSave = data => {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
196
|
+
try {
|
197
|
+
const updateData = {
|
198
|
+
...data
|
199
|
+
};
|
200
|
+
delete updateData.children;
|
201
|
+
Transforms.setNodes(editor, {
|
202
|
+
...updateData
|
203
|
+
}, {
|
204
|
+
at: path
|
205
|
+
});
|
206
|
+
onClose();
|
207
|
+
} catch (err) {
|
208
|
+
console.log(err);
|
209
|
+
}
|
202
210
|
};
|
203
211
|
const onClose = () => {
|
204
212
|
setOpenSettings(false);
|
@@ -231,7 +239,7 @@ const Image = ({
|
|
231
239
|
return /*#__PURE__*/_jsxs(Box, {
|
232
240
|
...attributes,
|
233
241
|
component: "div",
|
234
|
-
className: "embed has-hover",
|
242
|
+
className: "embed has-hover dpath",
|
235
243
|
sx: {
|
236
244
|
display: {
|
237
245
|
lg: "flex",
|
@@ -95,16 +95,20 @@ const Video = ({
|
|
95
95
|
setOpenSettings(true);
|
96
96
|
};
|
97
97
|
const onSave = data => {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
98
|
+
try {
|
99
|
+
const updateData = {
|
100
|
+
...data
|
101
|
+
};
|
102
|
+
delete updateData.children;
|
103
|
+
Transforms.setNodes(editor, {
|
104
|
+
...updateData
|
105
|
+
}, {
|
106
|
+
at: path
|
107
|
+
});
|
108
|
+
onClose();
|
109
|
+
} catch (err) {
|
110
|
+
console.log(err);
|
111
|
+
}
|
108
112
|
};
|
109
113
|
const onClose = () => {
|
110
114
|
setOpenSettings(false);
|
@@ -178,7 +182,7 @@ const Video = ({
|
|
178
182
|
};
|
179
183
|
return /*#__PURE__*/_jsxs(Box, {
|
180
184
|
...attributes,
|
181
|
-
className: "embed has-hover video",
|
185
|
+
className: "embed has-hover video dpath",
|
182
186
|
sx: {
|
183
187
|
display: {
|
184
188
|
lg: "flex",
|
@@ -2,10 +2,10 @@ import React, { useState, forwardRef, useImperativeHandle } from "react";
|
|
2
2
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
3
3
|
import { Paper, Popover } from "@mui/material";
|
4
4
|
import data from "@emoji-mart/data";
|
5
|
-
import Picker from "@emoji-mart/react";
|
6
5
|
import { insertEmoji } from "../../utils/emoji";
|
7
6
|
import ToolbarIcon from "../../common/ToolbarIcon";
|
8
7
|
import Icon from "../../common/Icon";
|
8
|
+
import EmojiPicker from "./EmojiPicker";
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -61,7 +61,7 @@ const EmojiButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
61
61
|
},
|
62
62
|
onClose: handleClose,
|
63
63
|
children: /*#__PURE__*/_jsx(Paper, {
|
64
|
-
children: /*#__PURE__*/_jsx(
|
64
|
+
children: /*#__PURE__*/_jsx(EmojiPicker, {
|
65
65
|
data: data,
|
66
66
|
onEmojiSelect: onEmojiSelect
|
67
67
|
})
|