@flozy/editor 1.6.7 → 1.6.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +1 -1
- package/dist/Editor/Editor.css +9 -9
- package/dist/Editor/Elements/Embed/Image.js +15 -18
- package/dist/Editor/Elements/Embed/Video.js +11 -11
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -1
- package/dist/Editor/Elements/Grid/Grid.js +0 -78
- package/dist/Editor/Elements/Signature/Signed.js +11 -1
- package/dist/Editor/common/Icon.js +2 -4
- package/dist/Editor/common/ImageList.js +4 -8
- package/dist/Editor/common/ImageSelector/ImageSelector.js +17 -30
- package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -1
- package/dist/Editor/common/ImageSelector/Options/Upload.js +5 -0
- package/dist/Editor/common/ImageSelector/Styles.js +67 -8
- package/dist/Editor/common/ImageSelector/UploadStyles.js +27 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +23 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +36 -35
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/Uploader.js +14 -23
- package/dist/Editor/common/iconslist.js +12 -0
- package/dist/Editor/utils/customHooks/useResize.js +12 -3
- package/dist/Editor/utils/embed.js +2 -2
- package/package.json +1 -1
@@ -125,7 +125,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
125
125
|
}));
|
126
126
|
}, [id, content]);
|
127
127
|
useEffect(() => {
|
128
|
-
if (editorWrapper && editorWrapper?.current && loadedValue !== deboundedValue && isInteracted && onSave) {
|
128
|
+
if (editorWrapper && editorWrapper?.current && JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
129
129
|
const {
|
130
130
|
value: strVal,
|
131
131
|
...restVal
|
package/dist/Editor/Editor.css
CHANGED
@@ -803,25 +803,25 @@ blockquote {
|
|
803
803
|
visibility: hidden;
|
804
804
|
opacity: 0;
|
805
805
|
transition: all 0.5s;
|
806
|
+
text-align: center;
|
806
807
|
}
|
807
808
|
|
808
809
|
.uploadImageSection:hover .removeImageText {
|
809
810
|
visibility: visible;
|
810
811
|
opacity: 1;
|
812
|
+
text-align: center;
|
811
813
|
}
|
812
814
|
|
813
815
|
.uploadImageText,
|
814
816
|
.removeImageText {
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
padding: 2px 8px;
|
819
|
-
background-color: #00000090;
|
820
|
-
font-size: 13px;
|
821
|
-
font-weight: 600;
|
817
|
+
font-size: 16px;
|
818
|
+
font-weight: 400;
|
819
|
+
width: 200px;
|
822
820
|
cursor: pointer;
|
823
|
-
|
824
|
-
|
821
|
+
color:#464646;
|
822
|
+
span {
|
823
|
+
text-transform: capitalize;
|
824
|
+
}
|
825
825
|
}
|
826
826
|
|
827
827
|
.textFontArrows {
|
@@ -26,7 +26,8 @@ const Image = ({
|
|
26
26
|
borderColor,
|
27
27
|
borderRadius,
|
28
28
|
cols,
|
29
|
-
rowHeight
|
29
|
+
rowHeight,
|
30
|
+
boxShadow
|
30
31
|
} = element;
|
31
32
|
const {
|
32
33
|
readOnly
|
@@ -48,16 +49,22 @@ const Image = ({
|
|
48
49
|
horizantal
|
49
50
|
} = alignment || {};
|
50
51
|
const editor = useSlateStatic();
|
51
|
-
// const selected = useSelected();
|
52
52
|
const [parentDOM, setParentDOM] = useState(null);
|
53
53
|
const [openSetttings, setOpenSettings] = useState(false);
|
54
|
+
const path = ReactEditor.findPath(editor, element);
|
54
55
|
const [size, onMouseDown, resizing, onLoad] = useResize({
|
55
56
|
parentDOM,
|
56
|
-
size: element?.size
|
57
|
+
size: element?.size,
|
58
|
+
onChange: uSize => {
|
59
|
+
Transforms.setNodes(editor, {
|
60
|
+
size: uSize
|
61
|
+
}, {
|
62
|
+
at: path
|
63
|
+
});
|
64
|
+
}
|
57
65
|
});
|
58
66
|
const arr = Array.from(Node.elements(editor));
|
59
67
|
const ele = arr.find(([elem]) => element === elem);
|
60
|
-
const path = ReactEditor.findPath(editor, element);
|
61
68
|
const {
|
62
69
|
hoverPath
|
63
70
|
} = useEditorContext();
|
@@ -69,18 +76,6 @@ const Image = ({
|
|
69
76
|
onLoad(element?.size || {});
|
70
77
|
}
|
71
78
|
}, []);
|
72
|
-
useEffect(() => {
|
73
|
-
if (!resizing) {
|
74
|
-
onLoad(element?.size || {});
|
75
|
-
}
|
76
|
-
}, [element?.size]);
|
77
|
-
useEffect(() => {
|
78
|
-
if (!resizing) {
|
79
|
-
Transforms.setNodes(editor, {
|
80
|
-
size: size
|
81
|
-
});
|
82
|
-
}
|
83
|
-
}, [resizing]);
|
84
79
|
const handleImageClick = () => {
|
85
80
|
Transforms.select(editor, {
|
86
81
|
anchor: Editor.start(editor, path),
|
@@ -121,7 +116,7 @@ const Image = ({
|
|
121
116
|
|
122
117
|
const ToolBar = () => {
|
123
118
|
return selected ? /*#__PURE__*/_jsx("div", {
|
124
|
-
className: "element-toolbar",
|
119
|
+
className: "element-toolbar visible-on-hover",
|
125
120
|
contentEditable: false,
|
126
121
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
127
122
|
title: "Image Settings",
|
@@ -174,7 +169,9 @@ const Image = ({
|
|
174
169
|
cols: cols
|
175
170
|
}) : /*#__PURE__*/_jsx("img", {
|
176
171
|
style: {
|
177
|
-
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px
|
172
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
173
|
+
objectFit: "cover",
|
174
|
+
boxShadow: boxShadow || "none"
|
178
175
|
},
|
179
176
|
alt: alt,
|
180
177
|
src: url,
|
@@ -38,27 +38,27 @@ const Video = ({
|
|
38
38
|
left,
|
39
39
|
right
|
40
40
|
} = bannerSpacing || {};
|
41
|
+
const path = ReactEditor.findPath(editor, element);
|
41
42
|
const [size, onMouseDown, resizing, onLoad] = useResize({
|
42
43
|
parentDOM,
|
43
|
-
size: element?.size
|
44
|
+
size: element?.size,
|
45
|
+
onChange: uSize => {
|
46
|
+
Transforms.setNodes(editor, {
|
47
|
+
size: uSize
|
48
|
+
}, {
|
49
|
+
at: path
|
50
|
+
});
|
51
|
+
}
|
44
52
|
});
|
45
53
|
const arr = Array.from(Node.elements(editor));
|
46
54
|
const ele = arr.find(([elem]) => element === elem);
|
47
|
-
const path = ReactEditor.findPath(editor, element);
|
48
55
|
useEffect(() => {
|
49
56
|
if (editor && ele[1] !== undefined) {
|
50
57
|
const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
|
51
58
|
setParentDOM(dom);
|
52
|
-
onLoad(
|
59
|
+
onLoad(element?.size || {});
|
53
60
|
}
|
54
61
|
}, []);
|
55
|
-
useEffect(() => {
|
56
|
-
if (!resizing) {
|
57
|
-
Transforms.setNodes(editor, {
|
58
|
-
size: size
|
59
|
-
});
|
60
|
-
}
|
61
|
-
}, [resizing]);
|
62
62
|
const ToolBar = () => {
|
63
63
|
return /*#__PURE__*/_jsxs("div", {
|
64
64
|
className: "element-toolbar visible-on-hover",
|
@@ -104,7 +104,7 @@ const Video = ({
|
|
104
104
|
});
|
105
105
|
};
|
106
106
|
const totalMinus = parseInt(left || 0) + parseInt(right || 0);
|
107
|
-
const width = resizing ? `${size.width}px` : `${size.widthInPercent}%`;
|
107
|
+
const width = resizing ? `${size.width}px` : `${size.widthInPercent || 100}%`;
|
108
108
|
return /*#__PURE__*/_jsxs("div", {
|
109
109
|
...attributes,
|
110
110
|
className: "embed has-hover",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Button, Divider, Grid, IconButton, Menu, MenuItem,
|
1
|
+
import { Button, Divider, Grid, IconButton, Menu, MenuItem, TextareaAutosize, Tooltip } from "@mui/material";
|
2
2
|
import React, { useState } from "react";
|
3
3
|
import FormStyles from "./Styles";
|
4
4
|
import Icon from "../../../common/Icon";
|
@@ -6,8 +6,6 @@ import { gridItem } from "../../utils/gridItem";
|
|
6
6
|
import GridPopup from "./GridPopup";
|
7
7
|
import { IconButton, Tooltip, Grid as GridContainer } from "@mui/material";
|
8
8
|
import { insertGrid } from "../../utils/grid";
|
9
|
-
// import useDragAndDrop from "../../common/useDragAndDrop";
|
10
|
-
import useResize from "../../utils/customHooks/useResize";
|
11
9
|
import { GridAddGridIcon, GridAddSectionIcon, GridSettingsIcon } from "../../common/iconslist";
|
12
10
|
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
13
11
|
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
@@ -34,7 +32,6 @@ const Grid = props => {
|
|
34
32
|
bgColor,
|
35
33
|
alignment,
|
36
34
|
backgroundImage,
|
37
|
-
// size: elSize,
|
38
35
|
fgColor,
|
39
36
|
borderWidth,
|
40
37
|
borderColor,
|
@@ -58,47 +55,14 @@ const Grid = props => {
|
|
58
55
|
bottomLeft,
|
59
56
|
bottomRight
|
60
57
|
} = borderRadius || {};
|
61
|
-
// const { height: elHeight } = elSize || {};
|
62
58
|
const editor = useSlateStatic();
|
63
|
-
// const selected = useSelected();
|
64
|
-
// const [selected, setSelected] = useState(false);
|
65
59
|
const path = ReactEditor.findPath(editor, element);
|
66
|
-
const [parentDOM, setParentDOM] = useState(null);
|
67
|
-
// resize
|
68
|
-
const [size,, resizing, onLoad] = useResize({
|
69
|
-
parentDOM,
|
70
|
-
size: element?.size,
|
71
|
-
isGrid: true
|
72
|
-
});
|
73
60
|
const arr = Array.from(Node.elements(editor));
|
74
61
|
const ele = arr.find(([elem]) => element === elem);
|
75
62
|
const {
|
76
63
|
hoverPath
|
77
64
|
} = useEditorContext();
|
78
65
|
const selected = hoverPath === path.join(",");
|
79
|
-
useEffect(() => {
|
80
|
-
if (editor && ele[1] !== undefined) {
|
81
|
-
const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
|
82
|
-
const {
|
83
|
-
height
|
84
|
-
} = dom?.getBoundingClientRect();
|
85
|
-
setParentDOM(dom);
|
86
|
-
onLoad(element?.size || {
|
87
|
-
height: height
|
88
|
-
});
|
89
|
-
}
|
90
|
-
}, []);
|
91
|
-
|
92
|
-
// upadate resize data once resize done
|
93
|
-
useEffect(() => {
|
94
|
-
if (!resizing) {
|
95
|
-
Transforms.setNodes(editor, {
|
96
|
-
size: size
|
97
|
-
}, {
|
98
|
-
at: path
|
99
|
-
});
|
100
|
-
}
|
101
|
-
}, [resizing]);
|
102
66
|
const onAddGridItem = () => {
|
103
67
|
const currentPath = editor.selection?.anchor?.path;
|
104
68
|
const ancestorsPath = Path.ancestors(currentPath, {
|
@@ -209,41 +173,6 @@ const Grid = props => {
|
|
209
173
|
console.log(err);
|
210
174
|
}
|
211
175
|
};
|
212
|
-
|
213
|
-
// const onDrop = (dropElement) => {
|
214
|
-
// try {
|
215
|
-
// Transforms.insertNodes(editor, JSON.parse(dropElement), {
|
216
|
-
// at: path,
|
217
|
-
// select: true,
|
218
|
-
// });
|
219
|
-
// } catch (err) {
|
220
|
-
// console.log(err);
|
221
|
-
// }
|
222
|
-
// };
|
223
|
-
|
224
|
-
// const onDragEnd = () => {
|
225
|
-
// try {
|
226
|
-
// const currentDelpath = ReactEditor.findPath(editor, element);
|
227
|
-
// if (currentDelpath) {
|
228
|
-
// Transforms.removeNodes(editor, { at: currentDelpath });
|
229
|
-
// }
|
230
|
-
// } catch (err) {
|
231
|
-
// console.log(err);
|
232
|
-
// }
|
233
|
-
// };
|
234
|
-
|
235
|
-
// const grid_drag_id = `grid_drag_${path.join("_")}`;
|
236
|
-
|
237
|
-
// const [dndElements, isDragging, isActiveDrag] = useDragAndDrop({
|
238
|
-
// editor,
|
239
|
-
// id: grid_drag_id,
|
240
|
-
// selected,
|
241
|
-
// path,
|
242
|
-
// element,
|
243
|
-
// onDragEnd,
|
244
|
-
// onDrop,
|
245
|
-
// });
|
246
|
-
|
247
176
|
const NewLineButtons = () => {
|
248
177
|
return !readOnly && selected && path.length === 2 ? /*#__PURE__*/_jsxs(_Fragment, {
|
249
178
|
children: [/*#__PURE__*/_jsx("div", {
|
@@ -380,14 +309,7 @@ const Grid = props => {
|
|
380
309
|
justifyContent: horizantal || "start",
|
381
310
|
flexDirection: flexDirection || "row",
|
382
311
|
width: "100%"
|
383
|
-
// height cause overlap issues TBD
|
384
|
-
// height: resizing
|
385
|
-
// ? `${size?.height}px`
|
386
|
-
// : elHeight
|
387
|
-
// ? `${elHeight}px`
|
388
|
-
// : "fit-content",
|
389
312
|
},
|
390
|
-
|
391
313
|
"data-path": path.join(","),
|
392
314
|
children: children
|
393
315
|
}), /*#__PURE__*/_jsx(NewLineButtons, {})]
|
@@ -27,7 +27,17 @@ const Signed = props => {
|
|
27
27
|
};
|
28
28
|
const onDelete = () => {
|
29
29
|
const path = ReactEditor.findPath(editor, element);
|
30
|
-
Transforms.
|
30
|
+
Transforms.setNodes(editor, {
|
31
|
+
type: "signature",
|
32
|
+
signature: null,
|
33
|
+
fontFamily: "",
|
34
|
+
signedBy: "",
|
35
|
+
signedOn: formatDate(new Date(), "MM/DD/YYYY"),
|
36
|
+
signedText: "",
|
37
|
+
children: [{
|
38
|
+
text: ""
|
39
|
+
}]
|
40
|
+
}, {
|
31
41
|
at: path
|
32
42
|
});
|
33
43
|
};
|
@@ -7,7 +7,7 @@ import { AiFillEdit, AiOutlineInsertRowBelow, AiOutlineInsertRowRight, AiOutline
|
|
7
7
|
import { SiLatex } from "react-icons/si";
|
8
8
|
import { RiDeleteColumn, RiDeleteRow } from "react-icons/ri";
|
9
9
|
import { IoIosImage, IoIosLink, IoMdArrowDroprightCircle, IoMdArrowDropdownCircle } from "react-icons/io";
|
10
|
-
import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal } from "./iconslist";
|
10
|
+
import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage } from "./iconslist";
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
const iconList = {
|
13
13
|
fontFamily: /*#__PURE__*/_jsx(FontFamilyIcon, {
|
@@ -170,9 +170,7 @@ const iconList = {
|
|
170
170
|
size: 20,
|
171
171
|
fill: "#64748B"
|
172
172
|
}),
|
173
|
-
fileUpload: /*#__PURE__*/_jsx(
|
174
|
-
size: 20
|
175
|
-
}),
|
173
|
+
fileUpload: /*#__PURE__*/_jsx(UploadImage, {}),
|
176
174
|
media: /*#__PURE__*/_jsx(MdOutlinePermMedia, {
|
177
175
|
size: 20
|
178
176
|
}),
|
@@ -30,12 +30,10 @@ const QuiltedImageList = props => {
|
|
30
30
|
width: "100%",
|
31
31
|
height: "100%"
|
32
32
|
},
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
marginTop: "0px"
|
38
|
-
},
|
33
|
+
cols: cols
|
34
|
+
// rowHeight={rowHeight || 121}
|
35
|
+
// style={{ marginTop: "0px" }}
|
36
|
+
,
|
39
37
|
children: [UploaderComp ? /*#__PURE__*/_jsx(ImageListItem, {
|
40
38
|
className: "img_upload_btn_list",
|
41
39
|
cols: 2,
|
@@ -47,8 +45,6 @@ const QuiltedImageList = props => {
|
|
47
45
|
}, `img_upload_btn`) : null, (itemData || []).map(item => {
|
48
46
|
const isSelected = (selected || []).find(f => f.img === item.img);
|
49
47
|
return /*#__PURE__*/_jsxs(ImageListItem, {
|
50
|
-
cols: item.cols || 1,
|
51
|
-
rows: item.rows || 1,
|
52
48
|
children: [/*#__PURE__*/_jsx("img", {
|
53
49
|
...srcset(item.img, rowHeight || 121, item.rows, item.cols),
|
54
50
|
alt: item.title,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
|
-
import { Button, Grid, Tab, Tabs, Dialog, DialogContent, DialogActions, DialogTitle, Typography } from "@mui/material";
|
2
|
+
import { Button, Grid, Tab, Tabs, Dialog, DialogContent, DialogActions, DialogTitle, Typography, Divider } from "@mui/material";
|
3
3
|
import Upload from "./Options/Upload";
|
4
4
|
import ChooseAssets from "./Options/ChooseAssets";
|
5
5
|
import AddLink from "./Options/AddLink";
|
@@ -28,6 +28,7 @@ const ImageSelector = props => {
|
|
28
28
|
setTabValue(newValue);
|
29
29
|
};
|
30
30
|
const onUploaded = url => {
|
31
|
+
console.log(url);
|
31
32
|
setImage(url);
|
32
33
|
};
|
33
34
|
const onSave = () => {
|
@@ -42,25 +43,15 @@ const ImageSelector = props => {
|
|
42
43
|
sx: classes.dialogWrapper,
|
43
44
|
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
44
45
|
children: /*#__PURE__*/_jsxs(Typography, {
|
45
|
-
variant: "body1",
|
46
46
|
sx: {
|
47
47
|
fontSize: "16px",
|
48
|
-
fontWeight:
|
48
|
+
fontWeight: 500
|
49
49
|
},
|
50
50
|
children: ["Add ", title]
|
51
51
|
})
|
52
|
-
}), /*#__PURE__*/_jsx(DialogContent, {
|
53
|
-
style: {
|
54
|
-
background: "#F0F5FA",
|
55
|
-
padding: "0px"
|
56
|
-
},
|
52
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(DialogContent, {
|
57
53
|
children: /*#__PURE__*/_jsxs(Grid, {
|
58
54
|
container: true,
|
59
|
-
spacing: 0,
|
60
|
-
style: {
|
61
|
-
width: "100%",
|
62
|
-
padding: "8px"
|
63
|
-
},
|
64
55
|
children: [/*#__PURE__*/_jsx(Grid, {
|
65
56
|
item: true,
|
66
57
|
xs: 4,
|
@@ -70,15 +61,6 @@ const ImageSelector = props => {
|
|
70
61
|
orientation: "vertical",
|
71
62
|
value: tabValue,
|
72
63
|
children: [/*#__PURE__*/_jsx(Tab, {
|
73
|
-
className: `${isActive("addLink")}`,
|
74
|
-
sx: classes.tab,
|
75
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
76
|
-
icon: "link"
|
77
|
-
}),
|
78
|
-
iconPosition: "start",
|
79
|
-
value: "addLink",
|
80
|
-
label: `Add ${title} Link`
|
81
|
-
}), /*#__PURE__*/_jsx(Tab, {
|
82
64
|
className: `${isActive("upload")} ${title !== "Image" ? "hidden" : ""}`,
|
83
65
|
sx: classes.tab,
|
84
66
|
icon: /*#__PURE__*/_jsx(Icon, {
|
@@ -96,6 +78,15 @@ const ImageSelector = props => {
|
|
96
78
|
iconPosition: "start",
|
97
79
|
value: "choose",
|
98
80
|
label: "Choose Media"
|
81
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
82
|
+
className: `${isActive("addLink")}`,
|
83
|
+
sx: classes.tab,
|
84
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
85
|
+
icon: "link"
|
86
|
+
}),
|
87
|
+
iconPosition: "start",
|
88
|
+
value: "addLink",
|
89
|
+
label: `Add ${title} Link`
|
99
90
|
})]
|
100
91
|
})
|
101
92
|
}), /*#__PURE__*/_jsx(Grid, {
|
@@ -104,28 +95,24 @@ const ImageSelector = props => {
|
|
104
95
|
sx: classes.imsRightWrpr,
|
105
96
|
children: /*#__PURE__*/_jsx(Comp, {
|
106
97
|
...props,
|
98
|
+
classes: classes,
|
107
99
|
onUploaded: onUploaded
|
108
100
|
})
|
109
101
|
})]
|
110
102
|
})
|
111
|
-
}), /*#__PURE__*/_jsxs(DialogActions, {
|
103
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(DialogActions, {
|
112
104
|
sx: {
|
113
105
|
p: 2
|
114
106
|
},
|
115
107
|
children: [/*#__PURE__*/_jsx(Button, {
|
116
108
|
onClick: onClose,
|
117
109
|
variant: "outlined",
|
118
|
-
|
119
|
-
className: "secondaryBtn",
|
110
|
+
sx: classes.closeBtn,
|
120
111
|
children: "Cancel"
|
121
112
|
}), /*#__PURE__*/_jsx(Button, {
|
122
113
|
onClick: onSave,
|
123
114
|
variant: "contained",
|
124
|
-
|
125
|
-
className: " primaryBtn",
|
126
|
-
sx: {
|
127
|
-
ml: 0
|
128
|
-
},
|
115
|
+
sx: classes.saveBtn,
|
129
116
|
children: "Save"
|
130
117
|
})]
|
131
118
|
})]
|
@@ -4,6 +4,7 @@ import CheckIcon from "@mui/icons-material/Check";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
5
|
const AddLink = props => {
|
6
6
|
const {
|
7
|
+
classes,
|
7
8
|
onUploaded,
|
8
9
|
title
|
9
10
|
} = props;
|
@@ -25,11 +26,13 @@ const AddLink = props => {
|
|
25
26
|
value: url,
|
26
27
|
onChange: handleChange,
|
27
28
|
helperText: "Click Check Icon and Save...",
|
29
|
+
sx: classes.addLinkField,
|
28
30
|
InputProps: {
|
29
31
|
endAdornment: /*#__PURE__*/_jsx(Tooltip, {
|
30
|
-
title: `Add ${
|
32
|
+
title: `Add ${title} URL`,
|
31
33
|
arrow: true,
|
32
34
|
children: /*#__PURE__*/_jsx(IconButton, {
|
35
|
+
sx: classes.addLinkBtn,
|
33
36
|
onClick: handleSave,
|
34
37
|
children: /*#__PURE__*/_jsx(CheckIcon, {})
|
35
38
|
})
|
@@ -4,6 +4,7 @@ import Uploader from "../../Uploader";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
5
|
const Upload = props => {
|
6
6
|
const {
|
7
|
+
classes,
|
7
8
|
value,
|
8
9
|
onUploaded,
|
9
10
|
customProps,
|
@@ -15,8 +16,12 @@ const Upload = props => {
|
|
15
16
|
return /*#__PURE__*/_jsx(Grid, {
|
16
17
|
item: true,
|
17
18
|
xs: 12,
|
19
|
+
sx: {
|
20
|
+
padding: 0
|
21
|
+
},
|
18
22
|
className: "ims-right",
|
19
23
|
children: /*#__PURE__*/_jsx(Uploader, {
|
24
|
+
classes: classes,
|
20
25
|
value: value,
|
21
26
|
data: {
|
22
27
|
key: "url"
|
@@ -2,17 +2,24 @@ const ImageSelectorStyles = () => ({
|
|
2
2
|
root: {},
|
3
3
|
tabs: {
|
4
4
|
"& button": {
|
5
|
-
fontSize: "
|
5
|
+
fontSize: "12px",
|
6
|
+
fontWeight: "500",
|
6
7
|
textTransform: "capitalize",
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
minHeight: "auto",
|
8
|
+
minHeight: '40px',
|
9
|
+
padding: '10px',
|
10
|
+
marginRight: '24px',
|
11
11
|
"&.hidden": {
|
12
12
|
display: "none"
|
13
13
|
},
|
14
14
|
"&.active": {
|
15
|
-
backgroundColor: "#FFF"
|
15
|
+
backgroundColor: "#FFF",
|
16
|
+
border: '1px solid #2563EB',
|
17
|
+
borderRadius: '7px',
|
18
|
+
'& svg': {
|
19
|
+
'& path': {
|
20
|
+
stroke: '#2563EB'
|
21
|
+
}
|
22
|
+
}
|
16
23
|
},
|
17
24
|
"&:hover": {
|
18
25
|
backgroundColor: "#ECECEC"
|
@@ -24,7 +31,7 @@ const ImageSelectorStyles = () => ({
|
|
24
31
|
}
|
25
32
|
},
|
26
33
|
"& .MuiTabs-indicator": {
|
27
|
-
|
34
|
+
display: 'none'
|
28
35
|
}
|
29
36
|
},
|
30
37
|
tab: {},
|
@@ -32,12 +39,15 @@ const ImageSelectorStyles = () => ({
|
|
32
39
|
height: "300px",
|
33
40
|
overflow: "auto",
|
34
41
|
backgroundColor: "#fff",
|
35
|
-
padding: "8px",
|
42
|
+
padding: "0 8px",
|
36
43
|
"& .MuiFormHelperText-root": {
|
37
44
|
marginLeft: "0px"
|
38
45
|
}
|
39
46
|
},
|
40
47
|
dialogWrapper: {
|
48
|
+
'& .MuiDialog-paper': {
|
49
|
+
borderRadius: '12px'
|
50
|
+
},
|
41
51
|
"& .primaryBtn": {
|
42
52
|
background: "#2563eb !important",
|
43
53
|
boxShadow: "0px 8px 24px rgba(30, 64, 175, 0.08)",
|
@@ -62,6 +72,55 @@ const ImageSelectorStyles = () => ({
|
|
62
72
|
width: "auto !important",
|
63
73
|
marginRight: "8px !important"
|
64
74
|
}
|
75
|
+
},
|
76
|
+
addLinkField: {
|
77
|
+
"& .MuiOutlinedInput-input": {
|
78
|
+
fontSize: '12px',
|
79
|
+
fontWeight: 500
|
80
|
+
},
|
81
|
+
'& .MuiOutlinedInput-root': {
|
82
|
+
boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)',
|
83
|
+
borderRadius: '7px',
|
84
|
+
'& fieldset': {
|
85
|
+
borderColor: '#D8DDE1'
|
86
|
+
},
|
87
|
+
'&:hover fieldset': {
|
88
|
+
borderColor: '#64748B'
|
89
|
+
},
|
90
|
+
'&.Mui-focused fieldset': {
|
91
|
+
borderColor: '#2563EB'
|
92
|
+
},
|
93
|
+
'& .MuiFormLabel-root': {}
|
94
|
+
}
|
95
|
+
},
|
96
|
+
addLinkBtn: {
|
97
|
+
borderRadius: '5px',
|
98
|
+
background: "#E7EDF7",
|
99
|
+
width: '20px',
|
100
|
+
height: '20px',
|
101
|
+
'& svg': {
|
102
|
+
width: '16px',
|
103
|
+
height: '16px'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
closeBtn: {
|
107
|
+
background: '#F4F6F9',
|
108
|
+
color: '#64748B',
|
109
|
+
fontSize: '14px',
|
110
|
+
fontWeight: 500,
|
111
|
+
padding: '4px 22px',
|
112
|
+
textTransform: 'none',
|
113
|
+
border: '1px solid #D8DDE1',
|
114
|
+
'&:hover': {
|
115
|
+
border: '1px solid #64748B'
|
116
|
+
}
|
117
|
+
},
|
118
|
+
saveBtn: {
|
119
|
+
background: '#2563EB',
|
120
|
+
fontSize: '14px',
|
121
|
+
fontWeight: 500,
|
122
|
+
padding: '4px 24px',
|
123
|
+
textTransform: 'none'
|
65
124
|
}
|
66
125
|
});
|
67
126
|
export default ImageSelectorStyles;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
const UploadStyles = () => ({
|
2
|
+
uploadContainer: {
|
3
|
+
border: '1px solid #2563EB',
|
4
|
+
padding: '10px',
|
5
|
+
borderRadius: "7px",
|
6
|
+
boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
|
7
|
+
},
|
8
|
+
uploadField: {
|
9
|
+
width: "100%",
|
10
|
+
backgroundSize: "contain",
|
11
|
+
backgroundRepeat: "no-repeat",
|
12
|
+
backgroundPosition: "center",
|
13
|
+
height: "250px",
|
14
|
+
position: "relative",
|
15
|
+
backgroundColor: "#EFF4FF",
|
16
|
+
borderRadius: "9px",
|
17
|
+
border: '1px dashed #2563EB'
|
18
|
+
},
|
19
|
+
uploadIcon: {
|
20
|
+
'& svg': {
|
21
|
+
'& path': {
|
22
|
+
stroke: '#2563EB'
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
});
|
27
|
+
export default UploadStyles;
|
@@ -11,19 +11,24 @@ const embedImageStyle = [{
|
|
11
11
|
key: "url",
|
12
12
|
type: "backgroundImage"
|
13
13
|
}]
|
14
|
-
},
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
},
|
15
|
+
// {
|
16
|
+
// tab: "Image List Settings",
|
17
|
+
// value: "imageListSettings",
|
18
|
+
// fields: [
|
19
|
+
// {
|
20
|
+
// label: "Image List Columns",
|
21
|
+
// key: "cols",
|
22
|
+
// type: "text",
|
23
|
+
// },
|
24
|
+
// {
|
25
|
+
// label: "Row Height",
|
26
|
+
// key: "rowHeight",
|
27
|
+
// type: "text",
|
28
|
+
// },
|
29
|
+
// ],
|
30
|
+
// },
|
31
|
+
{
|
27
32
|
tab: "Banner Spacing",
|
28
33
|
value: "bannerSpacing",
|
29
34
|
fields: [{
|
@@ -63,6 +68,11 @@ const embedImageStyle = [{
|
|
63
68
|
label: "Border Color",
|
64
69
|
key: "borderColor",
|
65
70
|
type: "color"
|
71
|
+
}, {
|
72
|
+
label: "Box Shadow",
|
73
|
+
key: "boxShadow",
|
74
|
+
type: "text",
|
75
|
+
placeholder: "Enter Box Shadow Code"
|
66
76
|
}]
|
67
77
|
}, {
|
68
78
|
tab: "Size",
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { Grid, Button, Typography } from "@mui/material";
|
3
|
-
import { UploadBtnIcon } from "../../iconslist";
|
4
3
|
import ImageSelector from "../../ImageSelector/ImageSelector";
|
4
|
+
import UploadStyles from "../../ImageSelector/UploadStyles";
|
5
|
+
import Icon from "../../Icon";
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
8
|
const BackgroundImage = props => {
|
@@ -16,6 +17,7 @@ const BackgroundImage = props => {
|
|
16
17
|
} = data;
|
17
18
|
const [base64, setBase64] = useState(value);
|
18
19
|
const [open, setOpen] = useState(false);
|
20
|
+
const classes = UploadStyles();
|
19
21
|
const onRemoveBG = () => {
|
20
22
|
setBase64(null);
|
21
23
|
onChange({
|
@@ -36,7 +38,7 @@ const BackgroundImage = props => {
|
|
36
38
|
handleClose();
|
37
39
|
};
|
38
40
|
return /*#__PURE__*/_jsxs(Grid, {
|
39
|
-
|
41
|
+
item: true,
|
40
42
|
children: [/*#__PURE__*/_jsx(Typography, {
|
41
43
|
variant: "body1",
|
42
44
|
color: "primary",
|
@@ -47,42 +49,41 @@ const BackgroundImage = props => {
|
|
47
49
|
},
|
48
50
|
children: "Upload Image"
|
49
51
|
}), /*#__PURE__*/_jsx(Grid, {
|
50
|
-
|
51
|
-
|
52
|
-
style: {
|
53
|
-
position: "relative",
|
54
|
-
marginTop: "12px",
|
55
|
-
marginBottom: "12px",
|
56
|
-
width: "100%",
|
57
|
-
backgroundImage: base64 ? `url(${base64})` : "none",
|
58
|
-
height: "200px",
|
59
|
-
borderRadius: "10px",
|
60
|
-
backgroundPosition: "center",
|
61
|
-
backgroundSize: "contain",
|
62
|
-
backgroundRepeat: "no-repeat",
|
63
|
-
backgroundColor: "rgba(0,0,0,0.5)"
|
64
|
-
},
|
52
|
+
container: true,
|
53
|
+
sx: classes.uploadContainer,
|
65
54
|
children: /*#__PURE__*/_jsx(Grid, {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
55
|
+
item: true,
|
56
|
+
xs: 12,
|
57
|
+
style: {
|
58
|
+
backgroundImage: base64 ? `url(${base64})` : "none",
|
59
|
+
height: "200px"
|
60
|
+
},
|
61
|
+
sx: classes.uploadField,
|
62
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
63
|
+
className: "uploadImageSection",
|
64
|
+
children: base64 ? /*#__PURE__*/_jsx(Grid, {
|
65
|
+
className: "removeImageText",
|
66
|
+
onClick: onRemoveBG,
|
67
|
+
children: "REMOVE"
|
68
|
+
}) : /*#__PURE__*/_jsx(Grid, {
|
69
|
+
className: "uploadImageText",
|
70
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
71
|
+
component: "label",
|
72
|
+
variant: "text",
|
81
73
|
style: {
|
82
|
-
|
74
|
+
background: "none"
|
83
75
|
},
|
84
|
-
|
85
|
-
|
76
|
+
onClick: handleClick,
|
77
|
+
sx: classes.uploadIcon,
|
78
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
79
|
+
icon: "fileUpload"
|
80
|
+
}), /*#__PURE__*/_jsx("span", {
|
81
|
+
style: {
|
82
|
+
paddingLeft: "8px"
|
83
|
+
},
|
84
|
+
children: "upload your image"
|
85
|
+
})]
|
86
|
+
})
|
86
87
|
})
|
87
88
|
})
|
88
89
|
})
|
@@ -2,7 +2,8 @@ import React, { useState } from "react";
|
|
2
2
|
import { Grid, Button } from "@mui/material";
|
3
3
|
import { convertBase64 } from "../utils/helper";
|
4
4
|
import { uploadFile } from "../service/fileupload";
|
5
|
-
import
|
5
|
+
import Icon from "./Icon";
|
6
|
+
import UploadStyles from "../common/ImageSelector/UploadStyles";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const Uploader = props => {
|
@@ -12,6 +13,7 @@ const Uploader = props => {
|
|
12
13
|
onUploaded,
|
13
14
|
customProps
|
14
15
|
} = props;
|
16
|
+
const classes = UploadStyles();
|
15
17
|
const {
|
16
18
|
key
|
17
19
|
} = data;
|
@@ -33,22 +35,16 @@ const Uploader = props => {
|
|
33
35
|
const result = await uploadFile(formData, customProps);
|
34
36
|
setUploading(false);
|
35
37
|
if (result && result?.imageURL) {
|
36
|
-
onUploaded(
|
37
|
-
[key]: result?.imageURL
|
38
|
-
});
|
38
|
+
onUploaded(result?.imageURL[0]);
|
39
39
|
}
|
40
40
|
};
|
41
41
|
const onRemoveBG = () => {
|
42
42
|
setBase64(null);
|
43
|
-
onUploaded(
|
44
|
-
[key]: "none"
|
45
|
-
});
|
43
|
+
onUploaded("none");
|
46
44
|
};
|
47
45
|
return /*#__PURE__*/_jsxs(Grid, {
|
48
46
|
container: true,
|
49
|
-
sx:
|
50
|
-
pt: 1
|
51
|
-
},
|
47
|
+
sx: classes.uploadContainer,
|
52
48
|
children: [/*#__PURE__*/_jsx(Grid, {
|
53
49
|
item: true,
|
54
50
|
xs: 12,
|
@@ -58,17 +54,9 @@ const Uploader = props => {
|
|
58
54
|
xs: 12,
|
59
55
|
className: "btn--wrpr",
|
60
56
|
style: {
|
61
|
-
|
62
|
-
width: "100%",
|
63
|
-
backgroundImage: base64 ? `url(${base64})` : "none",
|
64
|
-
backgroundSize: "contain",
|
65
|
-
backgroundRepeat: "no-repeat",
|
66
|
-
backgroundPosition: "center",
|
67
|
-
height: "200px",
|
68
|
-
position: "relative",
|
69
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
70
|
-
borderRadius: "10px"
|
57
|
+
backgroundImage: base64 ? `url(${base64})` : "none"
|
71
58
|
},
|
59
|
+
sx: classes.uploadField,
|
72
60
|
children: !uploading ? /*#__PURE__*/_jsx(Grid, {
|
73
61
|
className: "uploadImageSection",
|
74
62
|
children: base64 ? /*#__PURE__*/_jsx(Grid, {
|
@@ -79,10 +67,11 @@ const Uploader = props => {
|
|
79
67
|
className: "uploadImageText",
|
80
68
|
children: /*#__PURE__*/_jsxs(Button, {
|
81
69
|
component: "label",
|
82
|
-
variant: "
|
70
|
+
variant: "text",
|
83
71
|
style: {
|
84
72
|
background: "none"
|
85
73
|
},
|
74
|
+
sx: classes.uploadIcon,
|
86
75
|
children: [/*#__PURE__*/_jsx("input", {
|
87
76
|
type: "file",
|
88
77
|
style: {
|
@@ -90,11 +79,13 @@ const Uploader = props => {
|
|
90
79
|
width: "0px"
|
91
80
|
},
|
92
81
|
onChange: handleChange
|
93
|
-
}), /*#__PURE__*/_jsx(
|
82
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
83
|
+
icon: "fileUpload"
|
84
|
+
}), /*#__PURE__*/_jsx("span", {
|
94
85
|
style: {
|
95
86
|
paddingLeft: "8px"
|
96
87
|
},
|
97
|
-
children: "
|
88
|
+
children: "upload your image"
|
98
89
|
})]
|
99
90
|
})
|
100
91
|
})
|
@@ -1517,4 +1517,16 @@ export const PlusIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
1517
1517
|
strokeLinecap: "round",
|
1518
1518
|
strokeLinejoin: "round"
|
1519
1519
|
})]
|
1520
|
+
});
|
1521
|
+
export const UploadImage = () => /*#__PURE__*/_jsx("svg", {
|
1522
|
+
width: "38",
|
1523
|
+
height: "32",
|
1524
|
+
viewBox: "0 0 38 32",
|
1525
|
+
fill: "none",
|
1526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1527
|
+
children: /*#__PURE__*/_jsx("path", {
|
1528
|
+
d: "M29.8163 9.58251L29.8806 9.91219L30.2101 9.97734C34.3518 10.7964 37.5 14.4866 37.5 18.9474C37.5 24.0138 33.4469 28.1316 28.5 28.1316H23.9565V28.1315L23.9493 28.1316C23.8527 28.133 23.7566 28.1148 23.6665 28.0779C23.5763 28.041 23.4936 27.9859 23.4234 27.9153C23.3532 27.8448 23.2969 27.7601 23.2583 27.6661C23.2197 27.5721 23.1997 27.4709 23.1997 27.3684C23.1997 27.2659 23.2197 27.1647 23.2583 27.0707C23.2969 26.9767 23.3532 26.8921 23.4234 26.8215C23.4936 26.751 23.5763 26.6959 23.6665 26.6589C23.7566 26.622 23.8527 26.6038 23.9493 26.6052V26.6053H23.9565H28.5C32.6778 26.6053 36.0217 23.1825 36.0217 18.9474C36.0217 14.9479 33.0358 11.6747 29.1933 11.3181C29.0288 11.3014 28.8731 11.2281 28.7524 11.1079C28.6315 10.9874 28.553 10.8271 28.532 10.6527C28.2917 8.54527 27.3763 6.49581 25.7849 4.87354L25.428 5.22368L25.7849 4.87354C23.908 2.9603 21.4566 2.02632 19 2.02632C16.5427 2.02632 14.1061 2.95891 12.228 4.87355C10.0597 7.08383 9.14397 10.0853 9.48097 12.9531L9.48133 12.956C9.49474 13.0646 9.48534 13.1749 9.45388 13.2793C9.42242 13.3836 9.36977 13.4793 9.29996 13.5602C9.23016 13.6411 9.1449 13.7053 9.05021 13.7491C8.95574 13.7928 8.85366 13.8154 8.75058 13.8158H8.26087C4.75072 13.8158 1.97826 16.6559 1.97826 20.2105C1.97826 23.7651 4.75072 26.6053 8.26087 26.6053H14.0435V26.6053L14.0507 26.6052C14.1473 26.6038 14.2434 26.622 14.3335 26.6589C14.4237 26.6959 14.5064 26.751 14.5766 26.8215C14.6468 26.8921 14.7031 26.9767 14.7417 27.0707C14.7803 27.1647 14.8003 27.2659 14.8003 27.3684C14.8003 27.4709 14.7803 27.5721 14.7417 27.6661C14.7031 27.7601 14.6468 27.8448 14.5766 27.9153C14.5064 27.9859 14.4237 28.041 14.3335 28.0779C14.2434 28.1148 14.1473 28.133 14.0507 28.1316L14.0507 28.1316H14.0435H8.26087C3.99094 28.1316 0.5 24.5869 0.5 20.2105C0.5 16.0852 3.61641 12.7343 7.55871 12.3663L8.01514 12.3236L8.01222 11.8652C7.99355 8.93435 9.01416 6.01183 11.1864 3.79752L11.1864 3.7975C13.3418 1.60027 16.1735 0.5 19 0.5C21.8271 0.5 24.6696 1.59883 26.8265 3.79751L27.1834 3.44737L26.8265 3.79752C28.4274 5.42941 29.4021 7.45776 29.8163 9.58251ZM19.498 15.0104L19.4991 15.0115L24.0388 19.2184C24.0393 19.2189 24.0399 19.2194 24.0404 19.2199C24.3569 19.521 24.3533 20.0152 24.088 20.3106C23.838 20.5888 23.3218 20.6127 23.0442 20.3568C23.0441 20.3566 23.0439 20.3565 23.0438 20.3564L20.5794 18.0678L19.7391 17.2875V18.4342V30.7368C19.7391 31.1674 19.3993 31.5 19 31.5C18.6007 31.5 18.2609 31.1674 18.2609 30.7368V18.4342V17.2875L17.4206 18.0678L14.9562 20.3564C14.9561 20.3565 14.956 20.3566 14.9558 20.3568C14.6953 20.5969 14.1897 20.5869 13.8934 20.291C13.6373 20.0351 13.6548 19.5086 13.9591 19.2204C13.9595 19.22 13.96 19.2196 13.9604 19.2191L18.5009 15.0115L18.5022 15.0102C18.609 14.9106 18.6645 14.875 18.7115 14.8552C18.7568 14.8362 18.833 14.8158 19 14.8158C19.1494 14.8158 19.2369 14.8398 19.2955 14.8655C19.3563 14.8922 19.4156 14.9336 19.498 15.0104Z",
|
1529
|
+
fill: "#64748B",
|
1530
|
+
stroke: "#64748B"
|
1531
|
+
})
|
1520
1532
|
});
|
@@ -2,7 +2,8 @@ import { useState } from "react";
|
|
2
2
|
const useResize = ({
|
3
3
|
parentDOM,
|
4
4
|
size: defaultSize,
|
5
|
-
isGrid
|
5
|
+
isGrid,
|
6
|
+
onChange
|
6
7
|
}) => {
|
7
8
|
const {
|
8
9
|
width,
|
@@ -16,6 +17,9 @@ const useResize = ({
|
|
16
17
|
...defaultSize
|
17
18
|
});
|
18
19
|
const [resizing, setResizing] = useState(false);
|
20
|
+
let latest = {
|
21
|
+
...size
|
22
|
+
};
|
19
23
|
const onLoad = defaultSize => {
|
20
24
|
setSize({
|
21
25
|
widthInPercent: 100,
|
@@ -31,16 +35,21 @@ const useResize = ({
|
|
31
35
|
const onMouseUp = () => {
|
32
36
|
document.removeEventListener("pointermove", onMouseMove);
|
33
37
|
document.removeEventListener("pointerup", onMouseUp);
|
38
|
+
if (onChange) {
|
39
|
+
onChange(latest);
|
40
|
+
}
|
34
41
|
setResizing(false);
|
35
42
|
};
|
36
43
|
const onMouseMove = e => {
|
37
44
|
setSize(currentSize => {
|
38
45
|
const calcWidth = (currentSize.width || width) + e.movementX;
|
39
|
-
|
46
|
+
const calc = {
|
40
47
|
width: calcWidth,
|
41
|
-
height: (currentSize.height || height) + e.movementY,
|
48
|
+
height: (parseInt(currentSize.height) || height) + e.movementY,
|
42
49
|
widthInPercent: calcWidth / width * 100
|
43
50
|
};
|
51
|
+
latest = calc;
|
52
|
+
return calc;
|
44
53
|
});
|
45
54
|
};
|
46
55
|
return [size, onMouseDown, resizing, onLoad];
|