@flozy/editor 3.9.0 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +177 -109
- package/dist/Editor/Editor.css +8 -12
- package/dist/Editor/Elements/AI/AIInput.js +17 -18
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +23 -28
- 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 +177 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
- 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/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +27 -3
- 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 +3 -3
- package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +14 -3
- package/dist/Editor/Elements/Table/Styles.js +23 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +69 -7
- 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 +4 -2
- package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
- package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
- 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 +22 -16
- 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 -17
- 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/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/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/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +33 -29
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +31 -25
- 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/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/theme.js +189 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -1
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- 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/events.js +54 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +31 -2
- package/dist/Editor/utils/table.js +51 -43
- package/package.json +4 -3
@@ -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
|
}
|
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
|
|
71
71
|
children: [/*#__PURE__*/_jsx(Grid, {
|
72
72
|
item: true,
|
73
73
|
sx: classes.radioBtn,
|
74
|
-
children: /*#__PURE__*/
|
74
|
+
children: /*#__PURE__*/_jsxs(RadioGroup, {
|
75
75
|
name: "set timing",
|
76
76
|
value: schedule,
|
77
77
|
defaultValue: 1,
|
78
|
-
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
78
|
+
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
79
79
|
value: "immediately",
|
80
80
|
label: "Immediately",
|
81
81
|
onChange: () => {
|
@@ -84,7 +84,16 @@ const FormWorkflow = props => {
|
|
84
84
|
control: /*#__PURE__*/_jsx(Radio, {
|
85
85
|
size: "small"
|
86
86
|
})
|
87
|
-
})
|
87
|
+
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
88
|
+
value: "after",
|
89
|
+
label: "After",
|
90
|
+
onChange: () => {
|
91
|
+
setSchedule("after");
|
92
|
+
},
|
93
|
+
control: /*#__PURE__*/_jsx(Radio, {
|
94
|
+
size: "small"
|
95
|
+
})
|
96
|
+
})]
|
88
97
|
})
|
89
98
|
}), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
|
90
99
|
item: true,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
2
|
import React, { useState } from "react";
|
3
|
-
import { Transforms, Path } from "slate";
|
3
|
+
import { Transforms, Path, Node } from "slate";
|
4
4
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
5
5
|
import { IconButton, Tooltip, Grid as GridContainer } from "@mui/material";
|
6
6
|
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
@@ -15,6 +15,7 @@ import { gridItem } from "../../utils/gridItem";
|
|
15
15
|
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
16
16
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
17
17
|
import useWindowResize from "../../hooks/useWindowResize";
|
18
|
+
import { useTheme } from "@emotion/react";
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
19
20
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -29,11 +30,16 @@ const GridToolBar = ({
|
|
29
30
|
onAddGridItem,
|
30
31
|
onAddSection,
|
31
32
|
onMoveSection,
|
32
|
-
path
|
33
|
+
path,
|
34
|
+
isSectionFullWidth
|
33
35
|
}) => {
|
34
36
|
return selected && !showTool ? /*#__PURE__*/_jsxs("div", {
|
35
37
|
className: "grid-container-toolbar",
|
36
38
|
contentEditable: false,
|
39
|
+
style: isSectionFullWidth ? {
|
40
|
+
right: "4px",
|
41
|
+
top: "4px"
|
42
|
+
} : {},
|
37
43
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
38
44
|
title: "Grid Settings",
|
39
45
|
arrow: true,
|
@@ -74,7 +80,19 @@ const GridToolBar = ({
|
|
74
80
|
}) : null]
|
75
81
|
}) : null;
|
76
82
|
};
|
83
|
+
const getParentEl = (editor, path) => {
|
84
|
+
try {
|
85
|
+
if (path?.length) {
|
86
|
+
return Node.parent(editor, path);
|
87
|
+
} else {
|
88
|
+
return null;
|
89
|
+
}
|
90
|
+
} catch (err) {
|
91
|
+
return null;
|
92
|
+
}
|
93
|
+
};
|
77
94
|
const Grid = props => {
|
95
|
+
const theme = useTheme();
|
78
96
|
const {
|
79
97
|
attributes,
|
80
98
|
children,
|
@@ -113,6 +131,11 @@ const Grid = props => {
|
|
113
131
|
const selected = hoverPath === path.join(",");
|
114
132
|
const [showTool] = useEditorSelection(editor);
|
115
133
|
const [size] = useWindowResize();
|
134
|
+
const parentElement = getParentEl(editor, path);
|
135
|
+
const {
|
136
|
+
sectionGridSize
|
137
|
+
} = parentElement || {};
|
138
|
+
const isSectionFullWidth = sectionGridSize && sectionGridSize[size?.device] >= 12;
|
116
139
|
const onAddGridItem = () => {
|
117
140
|
const currentPath = editor.selection?.anchor?.path;
|
118
141
|
const ancestorsPath = Path.ancestors(currentPath, {
|
@@ -327,7 +350,8 @@ const Grid = props => {
|
|
327
350
|
onAddGridItem: onAddGridItem,
|
328
351
|
onAddSection: onAddSection,
|
329
352
|
onMoveSection: onMoveSection,
|
330
|
-
path: path
|
353
|
+
path: path,
|
354
|
+
isSectionFullWidth: isSectionFullWidth
|
331
355
|
})]
|
332
356
|
}), openSetttings ? /*#__PURE__*/_jsx(PoupComp, {
|
333
357
|
element: element,
|
@@ -8,6 +8,7 @@ import { GridSettingsIcon } from "../../common/iconslist";
|
|
8
8
|
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
9
9
|
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
10
10
|
import { isEmptyNode } from "../../utils/helper";
|
11
|
+
import { useTheme } from "@emotion/react";
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
14
|
const GridItemToolbar = ({
|
@@ -34,6 +35,7 @@ const GridItemToolbar = ({
|
|
34
35
|
}) : null;
|
35
36
|
};
|
36
37
|
const GridItem = props => {
|
38
|
+
const theme = useTheme();
|
37
39
|
const {
|
38
40
|
attributes,
|
39
41
|
children,
|
@@ -119,7 +121,7 @@ const GridItem = props => {
|
|
119
121
|
xs: xsHidden ? "none" : "flex"
|
120
122
|
},
|
121
123
|
flexDirection: flexDirection || "column",
|
122
|
-
background: bgColor
|
124
|
+
background: bgColor,
|
123
125
|
borderColor: getBorderColor(),
|
124
126
|
borderWidth: borderWidth || "1px",
|
125
127
|
borderRadius: {
|
@@ -9,6 +9,7 @@ import { removeLink } from "../../utils/link";
|
|
9
9
|
import LinkPopup from "./LinkPopup";
|
10
10
|
import "./styles.css";
|
11
11
|
import { absoluteLink } from "../../utils/helper";
|
12
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
15
|
const Link = props => {
|
@@ -29,6 +30,9 @@ const Link = props => {
|
|
29
30
|
const path = ReactEditor.findPath(editor, element);
|
30
31
|
const urlPath = element.url || element.href;
|
31
32
|
const absLink = absoluteLink(urlPath);
|
33
|
+
const {
|
34
|
+
theme
|
35
|
+
} = useEditorContext();
|
32
36
|
const updateLink = () => {
|
33
37
|
Transforms.setNodes(editor, {
|
34
38
|
href: linkData?.url,
|
@@ -107,7 +111,8 @@ const Link = props => {
|
|
107
111
|
linkData: linkData,
|
108
112
|
handleClose: handleClose,
|
109
113
|
handleInputChange: handleInputChange,
|
110
|
-
handleInsertLink: updateLink
|
114
|
+
handleInsertLink: updateLink,
|
115
|
+
theme: theme
|
111
116
|
})]
|
112
117
|
});
|
113
118
|
};
|
@@ -9,7 +9,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const LinkButton = props => {
|
11
11
|
const {
|
12
|
-
editor
|
12
|
+
editor,
|
13
|
+
theme
|
13
14
|
} = props;
|
14
15
|
const linkInputRef = useRef(null);
|
15
16
|
const [showInput, setShowInput] = useState(false);
|
@@ -77,7 +78,8 @@ const LinkButton = props => {
|
|
77
78
|
linkData: linkData,
|
78
79
|
handleClose: handleClose,
|
79
80
|
handleInputChange: handleInputChange,
|
80
|
-
handleInsertLink: handleInsertLink
|
81
|
+
handleInsertLink: handleInsertLink,
|
82
|
+
theme: theme
|
81
83
|
})]
|
82
84
|
});
|
83
85
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Dialog, DialogActions, DialogContent, DialogTitle, FormControl, FormControlLabel, Grid, TextField, Button, IconButton, Typography, Checkbox } from "@mui/material";
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
4
|
+
import LinkPopupStyles from "./LinkPopupStyles";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
7
|
const LinkPopup = props => {
|
@@ -9,8 +10,11 @@ const LinkPopup = props => {
|
|
9
10
|
handleClose,
|
10
11
|
linkData,
|
11
12
|
handleInputChange,
|
12
|
-
handleInsertLink
|
13
|
+
handleInsertLink,
|
14
|
+
theme
|
13
15
|
} = props;
|
16
|
+
const themeType = localStorage.getItem("themeType");
|
17
|
+
const classes = LinkPopupStyles(themeType);
|
14
18
|
return /*#__PURE__*/_jsxs(Dialog, {
|
15
19
|
fullWidth: true,
|
16
20
|
open: open,
|
@@ -44,13 +48,15 @@ const LinkPopup = props => {
|
|
44
48
|
style: {
|
45
49
|
paddingTop: "12px"
|
46
50
|
},
|
51
|
+
className: classes.titleTypo,
|
47
52
|
children: /*#__PURE__*/_jsx(TextField, {
|
48
53
|
size: "small",
|
49
54
|
fullWidth: true,
|
50
55
|
value: linkData?.name,
|
51
56
|
name: "name",
|
52
57
|
placeholder: "Link Title",
|
53
|
-
onChange: handleInputChange
|
58
|
+
onChange: handleInputChange,
|
59
|
+
sx: classes.addLinkField
|
54
60
|
})
|
55
61
|
}), /*#__PURE__*/_jsx(Grid, {
|
56
62
|
item: true,
|
@@ -64,7 +70,8 @@ const LinkPopup = props => {
|
|
64
70
|
name: "url",
|
65
71
|
value: linkData?.url,
|
66
72
|
placeholder: "https://google.com",
|
67
|
-
onChange: handleInputChange
|
73
|
+
onChange: handleInputChange,
|
74
|
+
sx: classes.addLinkField
|
68
75
|
})
|
69
76
|
}), /*#__PURE__*/_jsx(Grid, {
|
70
77
|
item: true,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const LinkPopupStyles = themeType => ({
|
2
|
+
addLinkField: {
|
3
|
+
"& .MuiOutlinedInput-input": {
|
4
|
+
fontSize: "12px",
|
5
|
+
fontWeight: 500,
|
6
|
+
color: themeType === "dark" ? "#FFFFFF !important" : "#000000 !important"
|
7
|
+
},
|
8
|
+
"& .MuiFormHelperText-root": {
|
9
|
+
color: themeType === "dark" ? "#FFFFFF !important" : "#000000 !important"
|
10
|
+
},
|
11
|
+
"& .MuiOutlinedInput-root": {
|
12
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.16)",
|
13
|
+
color: themeType === "dark" ? "#FFFFFF !important" : "#000000 !important",
|
14
|
+
borderRadius: "7px",
|
15
|
+
"& fieldset": {
|
16
|
+
borderColor: "#D8DDE1"
|
17
|
+
},
|
18
|
+
"&:hover fieldset": {
|
19
|
+
borderColor: "#64748B"
|
20
|
+
},
|
21
|
+
"&.Mui-focused fieldset": {
|
22
|
+
borderColor: "#2563EB"
|
23
|
+
},
|
24
|
+
"& .MuiFormLabel-root": {}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
});
|
28
|
+
export default LinkPopupStyles;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { useSlateStatic } from "slate-react";
|
3
3
|
import PageSettingsPopup from "./PageSettingsPopup";
|
4
|
-
import { PageSettings } from "../../common/iconslist";
|
5
4
|
import ToolbarIcon from "../../common/ToolbarIcon";
|
6
5
|
import { getPageSettings, updatePageSettings } from "../../utils/pageSettings";
|
6
|
+
import SettingsIcon from "../../assets/svg/SettingsIcon";
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
8
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -45,13 +45,13 @@ const PageSettingsButton = props => {
|
|
45
45
|
setOpenSettings(false);
|
46
46
|
};
|
47
47
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
48
|
-
children: [from === "miniToolBar" ? /*#__PURE__*/_jsx(
|
48
|
+
children: [from === "miniToolBar" ? /*#__PURE__*/_jsx(SettingsIcon, {
|
49
49
|
onClick: onSettings,
|
50
50
|
className: "removeDefaultSvgCls"
|
51
51
|
}) : /*#__PURE__*/_jsx(ToolbarIcon, {
|
52
52
|
title: "Page Settings",
|
53
53
|
onClick: onSettings,
|
54
|
-
icon: /*#__PURE__*/_jsx(
|
54
|
+
icon: /*#__PURE__*/_jsx(SettingsIcon, {}),
|
55
55
|
icoBtnType: icoBtnType
|
56
56
|
}), openSetttings !== false ? /*#__PURE__*/_jsx(PageSettingsPopup, {
|
57
57
|
element: openSetttings?.element || {},
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useSlateStatic } from "slate-react";
|
3
|
+
import RedoIcon from "../../assets/svg/RedoIcon";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const RedoButton = () => {
|
6
|
+
const editor = useSlateStatic();
|
7
|
+
const onRedo = () => {
|
8
|
+
editor?.redo();
|
9
|
+
};
|
10
|
+
return /*#__PURE__*/_jsx(RedoIcon, {
|
11
|
+
onClick: onRedo
|
12
|
+
});
|
13
|
+
};
|
14
|
+
export default RedoButton;
|
@@ -263,7 +263,12 @@ const SignaturePopup = props => {
|
|
263
263
|
name: "signedBy",
|
264
264
|
placeholder: "Enter Name",
|
265
265
|
size: "small",
|
266
|
-
onChange: onChange
|
266
|
+
onChange: onChange,
|
267
|
+
sx: {
|
268
|
+
'& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline': {
|
269
|
+
borderColor: '#ccc'
|
270
|
+
}
|
271
|
+
}
|
267
272
|
})
|
268
273
|
})]
|
269
274
|
}), /*#__PURE__*/_jsxs(Grid, {
|
@@ -311,7 +316,8 @@ const SignaturePopup = props => {
|
|
311
316
|
},
|
312
317
|
children: [/*#__PURE__*/_jsx(Grid, {
|
313
318
|
style: {
|
314
|
-
marginRight: "8px"
|
319
|
+
marginRight: "8px",
|
320
|
+
minWidth: '44px'
|
315
321
|
},
|
316
322
|
children: /*#__PURE__*/_jsx("label", {
|
317
323
|
htmlFor: "signedByEmail",
|
@@ -326,7 +332,12 @@ const SignaturePopup = props => {
|
|
326
332
|
name: "signedByEmail",
|
327
333
|
placeholder: "Enter Email",
|
328
334
|
size: "small",
|
329
|
-
onChange: onChange
|
335
|
+
onChange: onChange,
|
336
|
+
sx: {
|
337
|
+
'& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline': {
|
338
|
+
borderColor: '#ccc'
|
339
|
+
}
|
340
|
+
}
|
330
341
|
})
|
331
342
|
})]
|
332
343
|
})]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const TableStyles =
|
1
|
+
const TableStyles = themeType => ({
|
2
2
|
tableToolBar: {
|
3
3
|
position: "absolute",
|
4
4
|
top: "-34px",
|
@@ -61,6 +61,28 @@ const TableStyles = () => ({
|
|
61
61
|
"&:hover": {
|
62
62
|
background: "#ccc"
|
63
63
|
}
|
64
|
+
},
|
65
|
+
deleteCellsPopUp: {
|
66
|
+
backgroundColor: themeType === "dark" ? "#292C32" : "#FFFFFF",
|
67
|
+
borderRadius: "7px !important",
|
68
|
+
border: themeType === "dark" ? "1px solid #5B5E64" : "1px solid #E4E8EB",
|
69
|
+
zIndex: 100,
|
70
|
+
minWidth: "186px !important"
|
71
|
+
},
|
72
|
+
menuItemPopUp: {
|
73
|
+
padding: "5px 7px !important",
|
74
|
+
margin: "6px !important",
|
75
|
+
borderRadius: 1,
|
76
|
+
userSelect: "none",
|
77
|
+
color: themeType === "dark" ? "#2563EB" : "#0F172A",
|
78
|
+
"&:hover": {
|
79
|
+
// backgroundColor: "rgba(0, 123, 255, 0.1)",
|
80
|
+
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE"
|
81
|
+
},
|
82
|
+
"&.Mui-selected": {
|
83
|
+
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE",
|
84
|
+
color: themeType === "dark" ? "#F6F6F6" : "#0F172A"
|
85
|
+
}
|
64
86
|
}
|
65
87
|
});
|
66
88
|
export default TableStyles;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { useSelected, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, IconButton, Tooltip, Table as TableComp, TableBody } from "@mui/material";
|
4
|
+
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, Popper, Typography } from "@mui/material";
|
5
5
|
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
6
6
|
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
7
7
|
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
@@ -15,6 +15,7 @@ import { TableUtil } from "../../utils/table";
|
|
15
15
|
import TablePopup from "./TablePopup";
|
16
16
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
17
17
|
import TableStyles from "./Styles";
|
18
|
+
import useClickOutside from "../../hooks/useClickOutside";
|
18
19
|
import "./table.css";
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
2
|
-
import { Editor, Element } from "slate";
|
3
|
-
import { Box } from "@mui/material";
|
2
|
+
import { Editor, Element, Transforms } from "slate";
|
3
|
+
import { Box, MenuItem, Popper, Typography } from "@mui/material";
|
4
4
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
5
5
|
import useTableResize from "../../utils/customHooks/useTableResize";
|
6
6
|
import { TableUtil } from "../../utils/table";
|
7
7
|
import TableStyles from "./Styles";
|
8
8
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
9
|
+
import useClickOutside from "../../hooks/useClickOutside";
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -28,7 +29,8 @@ const Resizer = ({
|
|
28
29
|
});
|
29
30
|
};
|
30
31
|
const TableCell = props => {
|
31
|
-
const
|
32
|
+
const themeType = localStorage.getItem("themeType");
|
33
|
+
const classes = TableStyles(themeType);
|
32
34
|
const {
|
33
35
|
element,
|
34
36
|
attributes,
|
@@ -69,6 +71,42 @@ const TableCell = props => {
|
|
69
71
|
const tableDOM = table.getDOMNode(path, true);
|
70
72
|
const isCellSelected = table.isCellSelected(editor.selection);
|
71
73
|
const hasSelected = (isCellSelected || [])?.findIndex(f => f.join(",") === path.join(",")) > -1;
|
74
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
75
|
+
const open = Boolean(anchorEl);
|
76
|
+
const popperOptions = [{
|
77
|
+
value: "Delete Row"
|
78
|
+
}, {
|
79
|
+
value: "Delete Column"
|
80
|
+
}];
|
81
|
+
const onRightClick = e => {
|
82
|
+
e.preventDefault();
|
83
|
+
if (hasSelected) {
|
84
|
+
setAnchorEl(e.currentTarget);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
const closePoper = () => {
|
88
|
+
setAnchorEl(null);
|
89
|
+
};
|
90
|
+
const handleMenuItemClick = value => {
|
91
|
+
Transforms.select(editor, editor.selection);
|
92
|
+
switch (value) {
|
93
|
+
case "Delete Row":
|
94
|
+
table.deleteRow();
|
95
|
+
break;
|
96
|
+
case "Delete Column":
|
97
|
+
table.deleteColumn();
|
98
|
+
break;
|
99
|
+
default:
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
// closePoper();
|
103
|
+
};
|
104
|
+
|
105
|
+
// Use the useClickOutside hook
|
106
|
+
const popperRef = useClickOutside({
|
107
|
+
onClickOutside: closePoper,
|
108
|
+
refCount: 1
|
109
|
+
})[0];
|
72
110
|
useEffect(() => {
|
73
111
|
if (tableDOM) {
|
74
112
|
const {
|
@@ -89,7 +127,7 @@ const TableCell = props => {
|
|
89
127
|
cellWidth: parentWidth / columns
|
90
128
|
});
|
91
129
|
}
|
92
|
-
}, [tableDOM]);
|
130
|
+
}, [tableDOM, anchorEl]);
|
93
131
|
useEffect(() => {
|
94
132
|
if (editor && element && tableSize) {
|
95
133
|
const dom = ReactEditor.toDOMNode(editor, element);
|
@@ -99,14 +137,37 @@ const TableCell = props => {
|
|
99
137
|
height: 100
|
100
138
|
});
|
101
139
|
}
|
102
|
-
}, [tableSize]);
|
140
|
+
}, [tableSize, anchorEl]);
|
103
141
|
useEffect(() => {
|
104
142
|
if (!resizing && tableProps) {
|
105
143
|
table.updateTableStyle({
|
106
144
|
"col.size": size
|
107
145
|
}, tableProps);
|
108
146
|
}
|
109
|
-
}, [resizing]);
|
147
|
+
}, [resizing, anchorEl]);
|
148
|
+
const poperForDeltion = () => {
|
149
|
+
return /*#__PURE__*/_jsx(Popper, {
|
150
|
+
open: open,
|
151
|
+
anchorEl: anchorEl,
|
152
|
+
placement: "bottom-start",
|
153
|
+
disablePortal: true,
|
154
|
+
ref: popperRef,
|
155
|
+
sx: classes.deleteCellsPopUp,
|
156
|
+
children: popperOptions.map(option => /*#__PURE__*/_jsx(MenuItem, {
|
157
|
+
value: option.value,
|
158
|
+
onClick: () => handleMenuItemClick(option.value),
|
159
|
+
contentEditable: false,
|
160
|
+
sx: classes.menuItemPopUp,
|
161
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
162
|
+
sx: {
|
163
|
+
fontSize: "12px",
|
164
|
+
userSelect: "none"
|
165
|
+
},
|
166
|
+
children: option.value
|
167
|
+
})
|
168
|
+
}, option.value))
|
169
|
+
});
|
170
|
+
};
|
110
171
|
const sizeProps = isHeader ? {
|
111
172
|
width: size?.width || tableSize?.cellWidth
|
112
173
|
} : {};
|
@@ -121,6 +182,7 @@ const TableCell = props => {
|
|
121
182
|
border: `3px solid ${cellBorderColor}`,
|
122
183
|
...(sizeProps || {})
|
123
184
|
},
|
185
|
+
onContextMenu: onRightClick,
|
124
186
|
children: [children, isHeader && !readOnly && tableSize?.height && !showTool ? /*#__PURE__*/_jsx(Resizer, {
|
125
187
|
classes: classes,
|
126
188
|
onMouseDown: onMouseDown,
|
@@ -128,7 +190,7 @@ const TableCell = props => {
|
|
128
190
|
}) : null, hasSelected && !readOnly ? /*#__PURE__*/_jsx("div", {
|
129
191
|
className: "selection-area-tc",
|
130
192
|
contentEditable: false
|
131
|
-
}) : null]
|
193
|
+
}) : null, poperForDeltion()]
|
132
194
|
});
|
133
195
|
};
|
134
196
|
export default TableCell;
|
@@ -8,6 +8,7 @@ import { ReactEditor } from "slate-react";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const TableContextMenu = props => {
|
11
|
+
console.log("Table context menu :", props);
|
11
12
|
const {
|
12
13
|
editor
|
13
14
|
} = props;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useSlateStatic } from "slate-react";
|
3
|
+
import UndoIcon from "../../assets/svg/UndoIcon";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const UndoButton = () => {
|
6
|
+
const editor = useSlateStatic();
|
7
|
+
const onUndo = () => {
|
8
|
+
editor?.undo();
|
9
|
+
};
|
10
|
+
return /*#__PURE__*/_jsx(UndoIcon, {
|
11
|
+
onClick: onUndo
|
12
|
+
});
|
13
|
+
};
|
14
|
+
export default UndoButton;
|
@@ -23,7 +23,8 @@ const MiniEditor = props => {
|
|
23
23
|
miniEditorPlaceholder,
|
24
24
|
className,
|
25
25
|
otherProps,
|
26
|
-
onSave
|
26
|
+
onSave,
|
27
|
+
theme
|
27
28
|
} = props;
|
28
29
|
const {
|
29
30
|
CHARACTERS = []
|
@@ -132,6 +133,7 @@ const MiniEditor = props => {
|
|
132
133
|
editor: editor,
|
133
134
|
initialValue: content,
|
134
135
|
onChange: onChange,
|
136
|
+
theme: theme,
|
135
137
|
children: [/*#__PURE__*/_jsx(BasicToolbar, {
|
136
138
|
...props
|
137
139
|
}), /*#__PURE__*/_jsx(Editable, {
|
@@ -25,7 +25,8 @@ const BasicToolbar = props => {
|
|
25
25
|
hideTextColor = false,
|
26
26
|
hideResetIcon = true,
|
27
27
|
onResetClick = () => {}
|
28
|
-
}
|
28
|
+
},
|
29
|
+
theme
|
29
30
|
} = props;
|
30
31
|
// state
|
31
32
|
const [activeColor, setActiveColor] = useState("#000000");
|
@@ -65,7 +66,8 @@ const BasicToolbar = props => {
|
|
65
66
|
item: true,
|
66
67
|
children: /*#__PURE__*/_jsx(LinkButton, {
|
67
68
|
active: isBlockActive(editor, link.format),
|
68
|
-
editor: editor
|
69
|
+
editor: editor,
|
70
|
+
theme: theme
|
69
71
|
}, link.id)
|
70
72
|
}), !hideTextColor && /*#__PURE__*/_jsx(Grid, {
|
71
73
|
item: true,
|