@flozy/editor 1.6.6 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/dist/Editor/CommonEditor.js +2 -1
  2. package/dist/Editor/Editor.css +12 -16
  3. package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -3
  4. package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +12 -9
  5. package/dist/Editor/Elements/Carousel/Carousel.js +1 -1
  6. package/dist/Editor/Elements/Color Picker/Styles.js +2 -2
  7. package/dist/Editor/Elements/Embed/Image.js +15 -18
  8. package/dist/Editor/Elements/Embed/Video.js +11 -11
  9. package/dist/Editor/Elements/Form/Form.js +23 -1
  10. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +178 -0
  11. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +139 -0
  12. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +64 -0
  13. package/dist/Editor/Elements/Form/Workflow/Styles.js +207 -0
  14. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +207 -0
  15. package/dist/Editor/Elements/Form/Workflow/constant.js +3 -0
  16. package/dist/Editor/Elements/Form/Workflow/index.js +179 -0
  17. package/dist/Editor/Elements/Grid/Grid.js +0 -78
  18. package/dist/Editor/Elements/Grid/GridItem.js +8 -6
  19. package/dist/Editor/Elements/InlineIcon/InlineIcon.js +1 -2
  20. package/dist/Editor/Elements/Signature/Signed.js +11 -1
  21. package/dist/Editor/Elements/SimpleText.js +1 -3
  22. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -2
  23. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +0 -1
  24. package/dist/Editor/Styles/EditorStyles.js +2 -2
  25. package/dist/Editor/Toolbar/Mini/Styles.js +4 -2
  26. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -1
  27. package/dist/Editor/Toolbar/Toolbar.js +2 -1
  28. package/dist/Editor/Toolbar/toolbarGroups.js +2 -1
  29. package/dist/Editor/common/Icon.js +6 -6
  30. package/dist/Editor/common/ImageList.js +4 -8
  31. package/dist/Editor/common/ImageSelector/ImageSelector.js +18 -31
  32. package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -1
  33. package/dist/Editor/common/ImageSelector/Options/Upload.js +5 -0
  34. package/dist/Editor/common/ImageSelector/Styles.js +67 -8
  35. package/dist/Editor/common/ImageSelector/UploadStyles.js +27 -0
  36. package/dist/Editor/common/MentionsPopup/Styles.js +6 -3
  37. package/dist/Editor/common/StyleBuilder/embedImageStyle.js +23 -13
  38. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +36 -35
  39. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +29 -0
  40. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  41. package/dist/Editor/common/Uploader.js +14 -23
  42. package/dist/Editor/common/iconslist.js +79 -1
  43. package/dist/Editor/hooks/useMentions.js +0 -26
  44. package/dist/Editor/utils/customHooks/useResize.js +12 -3
  45. package/dist/Editor/utils/embed.js +16 -12
  46. package/dist/Editor/utils/emoji.js +0 -1
  47. package/dist/Editor/utils/form.js +1 -0
  48. package/dist/Editor/utils/insertAppHeader.js +66 -12
  49. package/package.json +2 -1
@@ -3,9 +3,10 @@ const usePopupStyles = () => ({
3
3
  position: "absolute",
4
4
  zIndex: 1000,
5
5
  background: "white",
6
- borderRadius: "0px",
6
+ borderRadius: "10px",
7
7
  padding: "0px",
8
- boxShadow: "0 4px 10px rgba(0,0,0,.2)"
8
+ boxShadow: "0 4px 10px rgba(0,0,0,.2)",
9
+ overflow: "hidden"
9
10
  },
10
11
  papper: {
11
12
  boxShadow: "none",
@@ -13,7 +14,8 @@ const usePopupStyles = () => ({
13
14
  height: "300px",
14
15
  overflow: "auto",
15
16
  padding: "8px",
16
- margin: "0px"
17
+ margin: "0px",
18
+ borderRadius: "10px"
17
19
  },
18
20
  groupHeader: {
19
21
  padding: "10px 8px",
@@ -26,6 +28,7 @@ const usePopupStyles = () => ({
26
28
  padding: "4px",
27
29
  cursor: "pointer",
28
30
  background: "transparent",
31
+ borderRadius: "10px",
29
32
  "&.active": {
30
33
  background: "rgba(55, 53, 47, 0.08)"
31
34
  },
@@ -11,19 +11,24 @@ const embedImageStyle = [{
11
11
  key: "url",
12
12
  type: "backgroundImage"
13
13
  }]
14
- }, {
15
- tab: "Image List Settings",
16
- value: "imageListSettings",
17
- fields: [{
18
- label: "Image List Columns",
19
- key: "cols",
20
- type: "text"
21
- }, {
22
- label: "Row Height",
23
- key: "rowHeight",
24
- type: "text"
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
- container: true,
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
- item: true,
51
- xs: 12,
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
- className: "uploadImageSection",
67
- children: base64 ? /*#__PURE__*/_jsx(Grid, {
68
- className: "removeImageText",
69
- onClick: onRemoveBG,
70
- children: "REMOVE"
71
- }) : /*#__PURE__*/_jsx(Grid, {
72
- className: "uploadImageText",
73
- children: /*#__PURE__*/_jsxs(Button, {
74
- component: "label",
75
- variant: "contained",
76
- style: {
77
- background: "none"
78
- },
79
- onClick: handleClick,
80
- children: [/*#__PURE__*/_jsx(UploadBtnIcon, {}), /*#__PURE__*/_jsx("span", {
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
- paddingLeft: "8px"
74
+ background: "none"
83
75
  },
84
- children: "UPLOAD"
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
  })
@@ -28,6 +28,35 @@ const gridItemStyle = [{
28
28
  key: "borderColorHover",
29
29
  type: "color"
30
30
  }]
31
+ }, {
32
+ tab: "Animation",
33
+ value: "animation",
34
+ fields: [{
35
+ label: "Choose Animation",
36
+ key: "animation",
37
+ type: "textOptions",
38
+ options: [{
39
+ text: "No Animation",
40
+ value: "No Animation"
41
+ }, {
42
+ text: "Fade In",
43
+ value: "animate__animated animate__fadeIn"
44
+ }, {
45
+ text: "Zoom In",
46
+ value: "animate__animated animate__zoomIn"
47
+ }, {
48
+ text: "Bounce In Left",
49
+ value: "animate__animated animate__bounceInLeft"
50
+ }],
51
+ renderOption: option => {
52
+ return /*#__PURE__*/_jsx("span", {
53
+ style: {
54
+ fontFamily: option.value
55
+ },
56
+ children: option.text
57
+ });
58
+ }
59
+ }]
31
60
  }, {
32
61
  tab: "Position",
33
62
  value: "position",
@@ -125,7 +125,7 @@ const StyleBuilder = props => {
125
125
  open: true,
126
126
  className: ` dialogComp tools-drawer`,
127
127
  anchor: "right",
128
- hideBackdrop: true,
128
+ onClose: onClose,
129
129
  children: /*#__PURE__*/_jsxs(Grid, {
130
130
  item: true,
131
131
  xs: 12,
@@ -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 { UploadBtnIcon } from "./iconslist";
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
- marginTop: "12px",
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: "contained",
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(UploadBtnIcon, {}), /*#__PURE__*/_jsx("span", {
82
+ }), /*#__PURE__*/_jsx(Icon, {
83
+ icon: "fileUpload"
84
+ }), /*#__PURE__*/_jsx("span", {
94
85
  style: {
95
86
  paddingLeft: "8px"
96
87
  },
97
- children: "UPLOAD"
88
+ children: "upload your image"
98
89
  })]
99
90
  })
100
91
  })
@@ -1451,4 +1451,82 @@ export const FileUploadIcon = () => {
1451
1451
  strokeLinejoin: "round"
1452
1452
  })]
1453
1453
  });
1454
- };
1454
+ };
1455
+ export const RestRight = () => /*#__PURE__*/_jsxs("svg", {
1456
+ width: "20",
1457
+ height: "16",
1458
+ viewBox: "0 0 22 23",
1459
+ fill: "none",
1460
+ xmlns: "http://www.w3.org/2000/svg",
1461
+ children: [/*#__PURE__*/_jsx("path", {
1462
+ d: "M13.6474 5.31C12.8499 5.07167 11.9699 4.91583 10.9983 4.91583C6.60745 4.91583 3.05078 8.4725 3.05078 12.8633C3.05078 17.2633 6.60745 20.82 10.9983 20.82C15.3891 20.82 18.9458 17.2633 18.9458 12.8725C18.9458 11.2408 18.4508 9.71917 17.6074 8.45417",
1463
+ stroke: "#64748B",
1464
+ strokeWidth: "1.5",
1465
+ strokeLinecap: "round",
1466
+ strokeLinejoin: "round"
1467
+ }), /*#__PURE__*/_jsx("path", {
1468
+ d: "M14.7859 5.53L12.1367 2.48666",
1469
+ stroke: "#64748B",
1470
+ strokeWidth: "1.5",
1471
+ strokeLinecap: "round",
1472
+ strokeLinejoin: "round"
1473
+ }), /*#__PURE__*/_jsx("path", {
1474
+ d: "M14.7845 5.53L11.6953 7.785",
1475
+ stroke: "#64748B",
1476
+ strokeWidth: "1.5",
1477
+ strokeLinecap: "round",
1478
+ strokeLinejoin: "round"
1479
+ })]
1480
+ });
1481
+ export const MoreHorizontal = ({
1482
+ width = "22",
1483
+ height = "22"
1484
+ }) => /*#__PURE__*/_jsxs("svg", {
1485
+ xmlns: "http://www.w3.org/2000/svg",
1486
+ width: width,
1487
+ height: height,
1488
+ viewBox: "0 0 22 22",
1489
+ fill: "none",
1490
+ children: [/*#__PURE__*/_jsx("path", {
1491
+ d: "M4.58333 9.16797C3.575 9.16797 2.75 9.99297 2.75 11.0013C2.75 12.0096 3.575 12.8346 4.58333 12.8346C5.59167 12.8346 6.41667 12.0096 6.41667 11.0013C6.41667 9.99297 5.59167 9.16797 4.58333 9.16797Z",
1492
+ fill: "#64748B"
1493
+ }), /*#__PURE__*/_jsx("path", {
1494
+ d: "M17.4168 9.16797C16.4085 9.16797 15.5835 9.99297 15.5835 11.0013C15.5835 12.0096 16.4085 12.8346 17.4168 12.8346C18.4252 12.8346 19.2502 12.0096 19.2502 11.0013C19.2502 9.99297 18.4252 9.16797 17.4168 9.16797Z",
1495
+ fill: "#64748B"
1496
+ }), /*#__PURE__*/_jsx("path", {
1497
+ d: "M10.9998 9.16797C9.9915 9.16797 9.1665 9.99297 9.1665 11.0013C9.1665 12.0096 9.9915 12.8346 10.9998 12.8346C12.0082 12.8346 12.8332 12.0096 12.8332 11.0013C12.8332 9.99297 12.0082 9.16797 10.9998 9.16797Z",
1498
+ fill: "#64748B"
1499
+ })]
1500
+ });
1501
+ export const PlusIcon = props => /*#__PURE__*/_jsxs("svg", {
1502
+ width: "12",
1503
+ height: "12",
1504
+ viewBox: "0 0 12 12",
1505
+ fill: "none",
1506
+ xmlns: "http://www.w3.org/2000/svg",
1507
+ children: [/*#__PURE__*/_jsx("path", {
1508
+ d: "M6 1.33331V10.6666",
1509
+ stroke: "#2563EB",
1510
+ strokeWidth: "1.4",
1511
+ strokeLinecap: "round",
1512
+ strokeLinejoin: "round"
1513
+ }), /*#__PURE__*/_jsx("path", {
1514
+ d: "M1.33203 6H10.6654",
1515
+ stroke: "#2563EB",
1516
+ strokeWidth: "1.4",
1517
+ strokeLinecap: "round",
1518
+ strokeLinejoin: "round"
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
+ })
1532
+ });
@@ -5,10 +5,6 @@ const TYPES = {
5
5
  "@": "mentions",
6
6
  "/": "elements"
7
7
  };
8
- const SHORTHAND_MATCHES = {
9
- mentions: new RegExp(/^@(\w+)$/),
10
- elements: new RegExp(/^\/(\w+)$/)
11
- };
12
8
  const getStartEnd = ({
13
9
  selection,
14
10
  editor
@@ -59,28 +55,6 @@ const getStartEnd = ({
59
55
  };
60
56
  }
61
57
  };
62
- const getRegexCategories = beforeText => {
63
- try {
64
- if (beforeText) {
65
- if (beforeText.match(SHORTHAND_MATCHES.mentions)) {
66
- return {
67
- type: "mentions",
68
- beforeMatch: beforeText.match(SHORTHAND_MATCHES.mentions)
69
- };
70
- } else if (beforeText.match(SHORTHAND_MATCHES.elements)) {
71
- return {
72
- type: "elements",
73
- beforeMatch: beforeText.match(SHORTHAND_MATCHES.elements)
74
- };
75
- }
76
- } else {
77
- return null;
78
- }
79
- } catch (err) {
80
- console.log(err);
81
- return null;
82
- }
83
- };
84
58
  const useMentions = props => {
85
59
  const {
86
60
  editor,
@@ -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
- return {
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];
@@ -20,22 +20,26 @@ export const createEmbedNode = (type, {
20
20
  text: " "
21
21
  }],
22
22
  size: {
23
- widthInPercent: "100%",
24
- height: "auto"
23
+ widthInPercent: "100",
24
+ height: type === "image" ? "auto" : 300
25
25
  },
26
26
  alignment: {
27
27
  horizantal: "center"
28
28
  }
29
29
  });
30
30
  export const insertEmbed = (editor, embedData, format) => {
31
- const {
32
- url,
33
- images
34
- } = embedData;
35
- if (!url && images.length === 0) return;
36
- const embed = createEmbedNode(format, embedData);
37
- Transforms.insertNodes(editor, embed, {
38
- at: editor.selection.anchor.path
39
- });
40
- insertNewLine(editor);
31
+ try {
32
+ const {
33
+ url,
34
+ images
35
+ } = embedData;
36
+ if (!url && images.length === 0) return;
37
+ const embed = createEmbedNode(format, embedData);
38
+ Transforms.insertNodes(editor, embed, {
39
+ at: editor.selection.anchor.path
40
+ });
41
+ insertNewLine(editor);
42
+ } catch (err) {
43
+ console.log(err);
44
+ }
41
45
  };
@@ -1,6 +1,5 @@
1
1
  import { Transforms } from "slate";
2
2
  export const insertEmoji = (editor, emoji, position) => {
3
- console.log(editor.selection);
4
3
  Transforms.insertText(editor, emoji, {
5
4
  at: position,
6
5
  select: true
@@ -17,6 +17,7 @@ export const insertForm = (editor, item) => {
17
17
  bottom: 12
18
18
  }
19
19
  },
20
+ workflow: [],
20
21
  children: [{
21
22
  ...formField()
22
23
  }]
@@ -2,19 +2,73 @@ import { Editor, Transforms, Path, Range, Element } from "slate";
2
2
  export const createAppHeaderNode = ({
3
3
  menus
4
4
  }) => ({
5
- type: "app-header",
6
- appTitle: "Title",
7
- appLogo: "https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/Netflix_2015_logo.svg/1200px-Netflix_2015_logo.svg.png",
8
- menus: !menus ? [{
9
- type: "menu",
10
- url: "https://www.google.com",
11
- target: "_blank",
12
- text: "Google"
13
- }] : menus,
14
- menuStyle: "stacked",
5
+ type: "grid",
6
+ grid: "container",
15
7
  children: [{
16
- text: ""
17
- }]
8
+ type: "grid-item",
9
+ grid: 12,
10
+ children: [{
11
+ type: "app-header",
12
+ appTitle: "Logo",
13
+ appLogo: "none",
14
+ menus: menus || [{
15
+ type: "menu",
16
+ url: "/",
17
+ target: "_blank",
18
+ text: "Home"
19
+ }, {
20
+ type: "menu",
21
+ url: "/wireframe2",
22
+ target: "_blank",
23
+ text: "Wireframe"
24
+ }, {
25
+ type: "menu",
26
+ url: "https://www.google.com",
27
+ target: "_blank",
28
+ text: "Work"
29
+ }, {
30
+ type: "menu",
31
+ url: "https://www.google.com",
32
+ target: "_blank",
33
+ text: "Contact"
34
+ }],
35
+ menuStyle: "stacked",
36
+ children: [{
37
+ text: " "
38
+ }],
39
+ logoFontSize: "32px",
40
+ titleFontFamily: "PoppinsBold",
41
+ bgColor: "rgb(255, 255, 255, 0)",
42
+ borderColor: "rgba(255, 255, 255, 0)",
43
+ textColor: "rgb(0, 0, 0)",
44
+ cellBgColor: "#FFFFFF"
45
+ }],
46
+ bgColor: "rgba(255, 255, 255, 0)",
47
+ lockSpacing: true,
48
+ bannerSpacing: {
49
+ top: "8",
50
+ left: "8",
51
+ right: "8",
52
+ bottom: "8"
53
+ },
54
+ alignment: {
55
+ horizantal: "center"
56
+ }
57
+ }],
58
+ alignment: {
59
+ flexDirection: "column"
60
+ },
61
+ lockSpacing: true,
62
+ bannerSpacing: {
63
+ top: "8",
64
+ left: "8",
65
+ right: "8",
66
+ bottom: "8"
67
+ },
68
+ size: {
69
+ widthInPercent: 100
70
+ },
71
+ bgColor: "rgba(255, 255, 255, 1)"
18
72
  });
19
73
  export const insertAppHeader = (editor, props) => {
20
74
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -22,6 +22,7 @@
22
22
  "@testing-library/jest-dom": "^5.16.5",
23
23
  "@testing-library/react": "^13.4.0",
24
24
  "@testing-library/user-event": "^13.5.0",
25
+ "animate.css": "^4.1.1",
25
26
  "emoji-mart": "^5.5.2",
26
27
  "html2canvas": "^1.4.1",
27
28
  "husky": "^8.0.3",