@flozy/editor 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/CommonEditor.js +7 -4
- package/dist/Editor/Editor.css +121 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +35 -0
- package/dist/Editor/Elements/Accordion/AccordionButton.js +21 -0
- package/dist/Editor/Elements/Accordion/AccordionDetails.js +18 -0
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +14 -0
- package/dist/Editor/Elements/Embed/Video.js +30 -5
- package/dist/Editor/Elements/Signature/Signature.js +48 -0
- package/dist/Editor/Elements/Signature/SignatureButton.js +18 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +34 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +83 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/index.js +4 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +174 -0
- package/dist/Editor/Elements/Signature/Signed.js +80 -0
- package/dist/Editor/Toolbar/Toolbar.js +25 -3
- package/dist/Editor/Toolbar/toolbarGroups.js +8 -10
- package/dist/Editor/utils/SlateUtilityFunctions.js +26 -11
- package/dist/Editor/utils/accordion.js +25 -0
- package/dist/Editor/utils/font.js +59 -0
- package/dist/Editor/utils/helper.js +16 -0
- package/dist/Editor/utils/signature.js +23 -0
- package/package.json +12 -5
|
@@ -72,9 +72,11 @@ const CommonEditor = props => {
|
|
|
72
72
|
onSave(JSON.stringify(value));
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
const renderElement = useCallback(props =>
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const renderElement = useCallback(props => {
|
|
76
|
+
return /*#__PURE__*/_jsx(Element, {
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
78
80
|
const renderLeaf = useCallback(props => {
|
|
79
81
|
return /*#__PURE__*/_jsx(Leaf, {
|
|
80
82
|
...props
|
|
@@ -87,7 +89,8 @@ const CommonEditor = props => {
|
|
|
87
89
|
}));
|
|
88
90
|
};
|
|
89
91
|
const onKeyDown = useCallback(event => {
|
|
90
|
-
const
|
|
92
|
+
const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
|
|
93
|
+
const isCtrlKey = event.ctrlKey || isMetaKey;
|
|
91
94
|
if (target && chars.length > 0 && !isCtrlKey) {
|
|
92
95
|
mentionsEvent({
|
|
93
96
|
event,
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -99,6 +99,127 @@ html{
|
|
|
99
99
|
position: relative;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
.accordion-container {
|
|
103
|
+
padding: 0px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.accordion-title {
|
|
107
|
+
position: relative;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.accordion-content {
|
|
111
|
+
padding-left: 32px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.accordion-summary-container {
|
|
115
|
+
padding: 8px 0px;
|
|
116
|
+
margin: 0px;
|
|
117
|
+
position: relative;
|
|
118
|
+
padding-left: 40px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.accordion-summary-collapse-btn {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 12px;
|
|
124
|
+
left: 0;
|
|
125
|
+
width: 32px;
|
|
126
|
+
height: 32px;
|
|
127
|
+
z-index: 1;
|
|
128
|
+
border-radius: 50%;
|
|
129
|
+
line-height: 1px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.accordion-details-container {
|
|
133
|
+
margin: 0px;
|
|
134
|
+
padding: 8px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.signature-btn-container button {
|
|
138
|
+
background-color: #0052CC;
|
|
139
|
+
padding: 8px 12px;
|
|
140
|
+
color: #FFFFFF;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
border-radius: 12px;
|
|
143
|
+
opacity: 1;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.signature-btn-grps {
|
|
147
|
+
display: flex;
|
|
148
|
+
justify-content: space-around;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.signature-btn-grps .MuiButtonBase-root {
|
|
152
|
+
border: 1px solid #2563eb;
|
|
153
|
+
color: #0f172a;
|
|
154
|
+
opacity: 1;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.signature-btn-grps .MuiButtonBase-root.active {
|
|
158
|
+
background-color: #0052CC;
|
|
159
|
+
color: #FFFFFF;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.signature-tab-content {
|
|
163
|
+
display: flex;
|
|
164
|
+
margin: 12px 16px;
|
|
165
|
+
padding: 0px;
|
|
166
|
+
border: 0px solid #CCC;
|
|
167
|
+
min-height: 100px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.signature-signed-wrapper {
|
|
171
|
+
position: relative;
|
|
172
|
+
display: flex;
|
|
173
|
+
}
|
|
174
|
+
.signature-signed-span {
|
|
175
|
+
position: relative;
|
|
176
|
+
}
|
|
177
|
+
.signature-signed-wrapper .signed-btn-del {
|
|
178
|
+
position: absolute;
|
|
179
|
+
right: -20px;
|
|
180
|
+
top: -20px;
|
|
181
|
+
opacity: 1;
|
|
182
|
+
z-index: 1;
|
|
183
|
+
}
|
|
184
|
+
.signed-btn {
|
|
185
|
+
text-align: center;
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.signed-text {
|
|
190
|
+
display: flex;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
margin-bottom: 8px;
|
|
193
|
+
padding-bottom: 8px;
|
|
194
|
+
border-bottom: 1px solid #000;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.typesignature-fontfamily .MuiButtonBase-root {
|
|
198
|
+
opacity: 1;
|
|
199
|
+
border: 1px solid #ccc;
|
|
200
|
+
}
|
|
201
|
+
.typesignature-fontfamily .MuiButtonBase-root.active {
|
|
202
|
+
border: 1px solid #0052CC;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.signature-canvas{
|
|
206
|
+
height: 100%;
|
|
207
|
+
width: 100%;
|
|
208
|
+
border: 1px solid #0052CC;
|
|
209
|
+
border-radius: 12px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.react-datepicker__input-container {
|
|
213
|
+
display: flex !important;
|
|
214
|
+
align-items: center;
|
|
215
|
+
}
|
|
216
|
+
.react-datepicker__input-container input {
|
|
217
|
+
height: 36px;
|
|
218
|
+
border: 1px solid #ccc;
|
|
219
|
+
border-radius: 5px;
|
|
220
|
+
width: 100%;
|
|
221
|
+
}
|
|
222
|
+
|
|
102
223
|
@media (max-width: 480px) {
|
|
103
224
|
.toolbar {
|
|
104
225
|
display: flex;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
|
|
3
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const Accordion = props => {
|
|
7
|
+
const {
|
|
8
|
+
attributes,
|
|
9
|
+
children
|
|
10
|
+
} = props;
|
|
11
|
+
const [toggle, setToggle] = useState(false);
|
|
12
|
+
const onToggle = () => {
|
|
13
|
+
setToggle(!toggle);
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
16
|
+
className: `accordion-container`,
|
|
17
|
+
...attributes,
|
|
18
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
19
|
+
className: "accordion-title",
|
|
20
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
21
|
+
className: "accordion-summary-collapse-btn",
|
|
22
|
+
contentEditable: false,
|
|
23
|
+
onClick: onToggle,
|
|
24
|
+
children: toggle ? /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}) : /*#__PURE__*/_jsx(KeyboardArrowRightIcon, {})
|
|
25
|
+
}), children[0]]
|
|
26
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
27
|
+
className: "accordion-content",
|
|
28
|
+
style: {
|
|
29
|
+
display: toggle ? "block" : "none"
|
|
30
|
+
},
|
|
31
|
+
children: children[1]
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export default Accordion;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ExpandCircleDownIcon from "@mui/icons-material/ExpandCircleDown";
|
|
3
|
+
import { insertAccordion } from "../../utils/accordion";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const AccordionButton = props => {
|
|
6
|
+
const {
|
|
7
|
+
editor
|
|
8
|
+
} = props;
|
|
9
|
+
const handleInsertAccordion = () => {
|
|
10
|
+
insertAccordion(editor);
|
|
11
|
+
};
|
|
12
|
+
return /*#__PURE__*/_jsx("button", {
|
|
13
|
+
onClick: handleInsertAccordion,
|
|
14
|
+
title: "Accordion",
|
|
15
|
+
style: {
|
|
16
|
+
marginLeft: "0px"
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/_jsx(ExpandCircleDownIcon, {})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export default AccordionButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const AccordionDetails = props => {
|
|
4
|
+
const {
|
|
5
|
+
attributes,
|
|
6
|
+
children
|
|
7
|
+
} = props;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
className: `accordion-details-container`,
|
|
10
|
+
...attributes,
|
|
11
|
+
style: {
|
|
12
|
+
height: "auto",
|
|
13
|
+
overflow: "hidden"
|
|
14
|
+
},
|
|
15
|
+
children: children
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default AccordionDetails;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const AccordionSummary = props => {
|
|
4
|
+
const {
|
|
5
|
+
attributes,
|
|
6
|
+
children
|
|
7
|
+
} = props;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
className: `accordion-summary-container`,
|
|
10
|
+
...attributes,
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export default AccordionSummary;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useSelected, useFocused } from "slate-react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { useSelected, useFocused, useSlateStatic, ReactEditor } from "slate-react";
|
|
3
|
+
import { Node, Transforms } from "slate";
|
|
3
4
|
import Icon from "../../common/Icon";
|
|
4
5
|
import useResize from "../../utils/customHooks/useResize";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -13,21 +14,45 @@ const Video = ({
|
|
|
13
14
|
url,
|
|
14
15
|
alt
|
|
15
16
|
} = element;
|
|
16
|
-
const
|
|
17
|
+
const editor = useSlateStatic();
|
|
17
18
|
const selected = useSelected();
|
|
18
19
|
const focused = useFocused();
|
|
20
|
+
const [parentDOM, setParentDOM] = useState(null);
|
|
21
|
+
const [size, onMouseDown, resizing, onLoad] = useResize({
|
|
22
|
+
parentDOM,
|
|
23
|
+
size: element?.size
|
|
24
|
+
});
|
|
25
|
+
const arr = Array.from(Node.elements(editor));
|
|
26
|
+
const ele = arr.find(([elem]) => element === elem);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (editor && ele[1] !== undefined) {
|
|
29
|
+
const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
|
|
30
|
+
setParentDOM(dom);
|
|
31
|
+
onLoad(dom);
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!resizing) {
|
|
36
|
+
Transforms.setNodes(editor, {
|
|
37
|
+
size: size
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, [resizing]);
|
|
19
41
|
return /*#__PURE__*/_jsxs("div", {
|
|
20
42
|
...attributes,
|
|
21
43
|
className: "embed",
|
|
22
44
|
style: {
|
|
23
45
|
display: "flex",
|
|
46
|
+
width: "100%",
|
|
47
|
+
maxWidth: "100%",
|
|
24
48
|
boxShadow: selected && focused && "0 0 3px 3px lightgray"
|
|
25
49
|
},
|
|
26
50
|
...element.attr,
|
|
27
51
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
28
52
|
contentEditable: false,
|
|
29
53
|
style: {
|
|
30
|
-
|
|
54
|
+
position: "relative",
|
|
55
|
+
width: size.widthInPercent ? `${size.widthInPercent}%` : `${size.width}px`,
|
|
31
56
|
height: `${size.height}px`
|
|
32
57
|
},
|
|
33
58
|
children: [
|
|
@@ -50,7 +75,7 @@ const Video = ({
|
|
|
50
75
|
frameBorder: "0",
|
|
51
76
|
title: alt
|
|
52
77
|
}), selected && /*#__PURE__*/_jsx("button", {
|
|
53
|
-
|
|
78
|
+
onPointerDown: onMouseDown,
|
|
54
79
|
style: {
|
|
55
80
|
width: "15px",
|
|
56
81
|
height: "15px",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Transforms } from "slate";
|
|
3
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
4
|
+
import SignaturePopup from "./SignaturePopup";
|
|
5
|
+
import { formatDate } from "../../utils/helper";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const Signature = props => {
|
|
9
|
+
const {
|
|
10
|
+
attributes,
|
|
11
|
+
children,
|
|
12
|
+
element
|
|
13
|
+
} = props;
|
|
14
|
+
const editor = useSlateStatic();
|
|
15
|
+
const isSigned = element?.children[0]?.type === "sign";
|
|
16
|
+
const path = ReactEditor.findPath(editor, element);
|
|
17
|
+
const onSave = (data = {}) => {
|
|
18
|
+
onClear();
|
|
19
|
+
Transforms.insertNodes(editor, [{
|
|
20
|
+
type: "sign",
|
|
21
|
+
signature: "https://sweetp-user-uploads.s3.eu-west-2.amazonaws.com/stage%20/%201696579641724_notes",
|
|
22
|
+
fontFamily: "",
|
|
23
|
+
signedBy: "",
|
|
24
|
+
signedOn: formatDate(new Date(), "MM/DD/YYYY"),
|
|
25
|
+
signedText: "",
|
|
26
|
+
children: [{
|
|
27
|
+
text: ""
|
|
28
|
+
}],
|
|
29
|
+
...data
|
|
30
|
+
}], {
|
|
31
|
+
at: [...path, 0]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const onClear = () => {
|
|
35
|
+
Transforms.removeNodes(editor, {
|
|
36
|
+
at: [...path, 0]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
40
|
+
className: `signature-container`,
|
|
41
|
+
...attributes,
|
|
42
|
+
children: [!isSigned ? /*#__PURE__*/_jsx(SignaturePopup, {
|
|
43
|
+
onSave: onSave,
|
|
44
|
+
onClear: onClear
|
|
45
|
+
}) : null, children]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export default Signature;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DrawIcon from "@mui/icons-material/Draw";
|
|
3
|
+
import { insertSignature } from "../../utils/signature";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const SignatureButton = props => {
|
|
6
|
+
const {
|
|
7
|
+
editor
|
|
8
|
+
} = props;
|
|
9
|
+
const handleInsertSignature = () => {
|
|
10
|
+
insertSignature(editor);
|
|
11
|
+
};
|
|
12
|
+
return /*#__PURE__*/_jsx("button", {
|
|
13
|
+
onClick: handleInsertSignature,
|
|
14
|
+
title: "Signature",
|
|
15
|
+
children: /*#__PURE__*/_jsx(DrawIcon, {})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default SignatureButton;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import SignatureCanvas from "react-signature-canvas";
|
|
3
|
+
import { Grid } from "@mui/material";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const DrawSignature = props => {
|
|
6
|
+
let canvasRef = useRef();
|
|
7
|
+
const {
|
|
8
|
+
onDataChange
|
|
9
|
+
} = props;
|
|
10
|
+
const onSigned = () => {
|
|
11
|
+
onDataChange({
|
|
12
|
+
signature: canvasRef.toDataURL()
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
16
|
+
container: true,
|
|
17
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
18
|
+
item: true,
|
|
19
|
+
xs: 12,
|
|
20
|
+
style: {
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "209px"
|
|
23
|
+
},
|
|
24
|
+
children: /*#__PURE__*/_jsx(SignatureCanvas, {
|
|
25
|
+
canvasProps: {
|
|
26
|
+
className: "signature-canvas"
|
|
27
|
+
},
|
|
28
|
+
onEnd: onSigned,
|
|
29
|
+
ref: ref => canvasRef = ref
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export default DrawSignature;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { signedTextFonts } from "../../../utils/font";
|
|
3
|
+
import { Grid, Button, TextField, InputAdornment, IconButton } from "@mui/material";
|
|
4
|
+
import ClearIcon from "@mui/icons-material/Clear";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const TypeSignature = props => {
|
|
8
|
+
const {
|
|
9
|
+
onDataChange
|
|
10
|
+
} = props;
|
|
11
|
+
const [name, setName] = useState("");
|
|
12
|
+
const [fontFamily, setFontFamily] = useState("");
|
|
13
|
+
const onChange = e => {
|
|
14
|
+
setName(e.target.value);
|
|
15
|
+
onDataChange({
|
|
16
|
+
signedText: e.target.value,
|
|
17
|
+
signature: ""
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const onFontFamilyChange = val => () => {
|
|
21
|
+
setFontFamily(val);
|
|
22
|
+
onDataChange({
|
|
23
|
+
fontFamily: val
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const renderFontFamily = () => {
|
|
27
|
+
return signedTextFonts.map((m, i) => {
|
|
28
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
29
|
+
padding: 1,
|
|
30
|
+
xs: 4,
|
|
31
|
+
style: {
|
|
32
|
+
textAlign: "center"
|
|
33
|
+
},
|
|
34
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
35
|
+
style: {
|
|
36
|
+
fontFamily: m.text
|
|
37
|
+
},
|
|
38
|
+
fullWidth: true,
|
|
39
|
+
onClick: onFontFamilyChange(m.value),
|
|
40
|
+
className: m.value === fontFamily ? "active" : "",
|
|
41
|
+
children: name || "Signature"
|
|
42
|
+
})
|
|
43
|
+
}, `typesign-ff-${m.value}`);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
+
className: "signature-tab-0-wrapper",
|
|
48
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: "typesignature-input-wrapper",
|
|
50
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
51
|
+
container: true,
|
|
52
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
53
|
+
item: true,
|
|
54
|
+
padding: 1,
|
|
55
|
+
xs: 12,
|
|
56
|
+
style: {
|
|
57
|
+
textAlign: "center"
|
|
58
|
+
},
|
|
59
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
60
|
+
value: name,
|
|
61
|
+
onChange: onChange,
|
|
62
|
+
size: "small",
|
|
63
|
+
fullWidth: true,
|
|
64
|
+
InputProps: {
|
|
65
|
+
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
|
66
|
+
position: "end",
|
|
67
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
68
|
+
onClick: () => setName(""),
|
|
69
|
+
children: /*#__PURE__*/_jsx(ClearIcon, {})
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
77
|
+
container: true,
|
|
78
|
+
className: "typesignature-fontfamily",
|
|
79
|
+
children: renderFontFamily()
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export default TypeSignature;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField } from "@mui/material";
|
|
3
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
4
|
+
import DatePicker from "react-datepicker";
|
|
5
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
6
|
+
import SignatureOptions from "./SignatureOptions";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
+
const SignaturePopup = props => {
|
|
11
|
+
const {
|
|
12
|
+
onSave,
|
|
13
|
+
onClear
|
|
14
|
+
} = props;
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
const [tab, setTab] = useState(0);
|
|
17
|
+
const SeletectedTab = SignatureOptions[tab];
|
|
18
|
+
const [signedData, setSignedData] = useState({});
|
|
19
|
+
const handleOpen = () => {
|
|
20
|
+
setOpen(true);
|
|
21
|
+
};
|
|
22
|
+
const handleClose = () => {
|
|
23
|
+
setOpen(false);
|
|
24
|
+
};
|
|
25
|
+
const handleSave = () => {
|
|
26
|
+
onSave(signedData);
|
|
27
|
+
handleClose();
|
|
28
|
+
};
|
|
29
|
+
const handleClear = () => {
|
|
30
|
+
onClear();
|
|
31
|
+
handleClose();
|
|
32
|
+
};
|
|
33
|
+
const onDataChange = data => {
|
|
34
|
+
setSignedData({
|
|
35
|
+
...signedData,
|
|
36
|
+
...data
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const onChange = e => {
|
|
40
|
+
setSignedData({
|
|
41
|
+
...signedData,
|
|
42
|
+
[e.target.name]: e.target.value
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: `signature-btn-container`,
|
|
48
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
49
|
+
contentEditable: false,
|
|
50
|
+
onClick: handleOpen,
|
|
51
|
+
children: "Sign Here"
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/_jsxs(Dialog, {
|
|
54
|
+
open: open,
|
|
55
|
+
onClose: handleClose,
|
|
56
|
+
fullWidth: true,
|
|
57
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
|
58
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
59
|
+
style: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
justifyContent: "space-between"
|
|
62
|
+
},
|
|
63
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
64
|
+
style: {
|
|
65
|
+
display: "flex"
|
|
66
|
+
},
|
|
67
|
+
children: "Signature"
|
|
68
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
69
|
+
style: {
|
|
70
|
+
display: "flex"
|
|
71
|
+
},
|
|
72
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
73
|
+
onClick: handleClose,
|
|
74
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
78
|
+
}), /*#__PURE__*/_jsxs(DialogContent, {
|
|
79
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
80
|
+
className: "signature-btn-grps",
|
|
81
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
82
|
+
onClick: () => setTab(0),
|
|
83
|
+
className: tab === 0 ? "active" : "",
|
|
84
|
+
children: "Draw Signature"
|
|
85
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
86
|
+
onClick: () => setTab(1),
|
|
87
|
+
className: tab === 1 ? "active" : "",
|
|
88
|
+
children: "Type Signature"
|
|
89
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
90
|
+
onClick: () => setTab(2),
|
|
91
|
+
className: tab === 2 ? "active" : "",
|
|
92
|
+
children: "Upload Signature"
|
|
93
|
+
})]
|
|
94
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
95
|
+
className: "signature-tab-content",
|
|
96
|
+
children: SeletectedTab ? /*#__PURE__*/_jsx(SeletectedTab, {
|
|
97
|
+
onDataChange: onDataChange
|
|
98
|
+
}) : null
|
|
99
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
100
|
+
container: true,
|
|
101
|
+
padding: 2,
|
|
102
|
+
style: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
justifyContent: "space-between"
|
|
105
|
+
},
|
|
106
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
|
107
|
+
item: true,
|
|
108
|
+
xs: 5,
|
|
109
|
+
style: {
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center"
|
|
112
|
+
},
|
|
113
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
114
|
+
style: {
|
|
115
|
+
marginRight: "8px"
|
|
116
|
+
},
|
|
117
|
+
children: /*#__PURE__*/_jsx("label", {
|
|
118
|
+
htmlFor: "signedBy",
|
|
119
|
+
children: "Name:"
|
|
120
|
+
})
|
|
121
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
122
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
123
|
+
id: "signedBy",
|
|
124
|
+
name: "signedBy",
|
|
125
|
+
placeholder: "Enter Name",
|
|
126
|
+
size: "small",
|
|
127
|
+
onChange: onChange
|
|
128
|
+
})
|
|
129
|
+
})]
|
|
130
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
131
|
+
item: true,
|
|
132
|
+
xs: 5,
|
|
133
|
+
style: {
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center"
|
|
136
|
+
},
|
|
137
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
138
|
+
style: {
|
|
139
|
+
marginRight: "8px"
|
|
140
|
+
},
|
|
141
|
+
children: /*#__PURE__*/_jsx("label", {
|
|
142
|
+
htmlFor: "signedOn",
|
|
143
|
+
children: "Date:"
|
|
144
|
+
})
|
|
145
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
146
|
+
children: /*#__PURE__*/_jsx(DatePicker, {
|
|
147
|
+
showIcon: true,
|
|
148
|
+
id: "signedOn",
|
|
149
|
+
selected: signedData?.signedOn ? new Date(signedData?.signedOn) : new Date(),
|
|
150
|
+
dateFormat: "MM/dd/yyyy",
|
|
151
|
+
onChange: date => {
|
|
152
|
+
console.log(date);
|
|
153
|
+
setSignedData({
|
|
154
|
+
...signedData,
|
|
155
|
+
signedOn: new Date(date).toISOString().split("T")[0]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
160
|
+
})]
|
|
161
|
+
})]
|
|
162
|
+
}), /*#__PURE__*/_jsxs(DialogActions, {
|
|
163
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
164
|
+
onClick: handleClear,
|
|
165
|
+
children: "Clear"
|
|
166
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
167
|
+
onClick: handleSave,
|
|
168
|
+
children: "Save"
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
export default SignaturePopup;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
3
|
+
import { IconButton } from "@mui/material";
|
|
4
|
+
import { Transforms } from "slate";
|
|
5
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
6
|
+
import { fontFamilyMap } from "../../utils/font";
|
|
7
|
+
import { formatDate } from "../../utils/helper";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const Signed = props => {
|
|
11
|
+
const editor = useSlateStatic();
|
|
12
|
+
const {
|
|
13
|
+
attributes,
|
|
14
|
+
element,
|
|
15
|
+
children
|
|
16
|
+
} = props;
|
|
17
|
+
const {
|
|
18
|
+
signature,
|
|
19
|
+
signedBy,
|
|
20
|
+
signedOn,
|
|
21
|
+
signedText,
|
|
22
|
+
fontFamily
|
|
23
|
+
} = element;
|
|
24
|
+
const [selected, setSelected] = useState(false);
|
|
25
|
+
const onSelect = () => {
|
|
26
|
+
setSelected(!selected);
|
|
27
|
+
};
|
|
28
|
+
const onDelete = () => {
|
|
29
|
+
const path = ReactEditor.findPath(editor, element);
|
|
30
|
+
Transforms.removeNodes(editor, {
|
|
31
|
+
at: path
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const renderSign = () => {
|
|
35
|
+
if (signature) {
|
|
36
|
+
return /*#__PURE__*/_jsx("img", {
|
|
37
|
+
src: signature,
|
|
38
|
+
alt: "signature",
|
|
39
|
+
style: {
|
|
40
|
+
width: "150px",
|
|
41
|
+
height: "auto"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
} else if (signedText) {
|
|
45
|
+
return /*#__PURE__*/_jsx("span", {
|
|
46
|
+
className: "signed-text",
|
|
47
|
+
style: {
|
|
48
|
+
fontFamily: fontFamilyMap[fontFamily]
|
|
49
|
+
},
|
|
50
|
+
children: signedText
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
56
|
+
className: "signature-signed-wrapper",
|
|
57
|
+
...attributes,
|
|
58
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
59
|
+
className: "signature-signed-span",
|
|
60
|
+
contentEditable: false,
|
|
61
|
+
children: [selected ? /*#__PURE__*/_jsx(IconButton, {
|
|
62
|
+
className: "signed-btn-del",
|
|
63
|
+
onClick: onDelete,
|
|
64
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
65
|
+
}) : null, /*#__PURE__*/_jsxs("button", {
|
|
66
|
+
className: "signed-btn",
|
|
67
|
+
onClick: onSelect,
|
|
68
|
+
children: [renderSign(), /*#__PURE__*/_jsx("div", {
|
|
69
|
+
style: {
|
|
70
|
+
fontWeight: "bold"
|
|
71
|
+
},
|
|
72
|
+
children: signedBy || ""
|
|
73
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
74
|
+
children: formatDate(signedOn, "MM/DD/YYYY")
|
|
75
|
+
})]
|
|
76
|
+
})]
|
|
77
|
+
}), children]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
export default Signed;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Select, MenuItem } from "@mui/material";
|
|
2
3
|
import { useSlate } from "slate-react";
|
|
3
4
|
import Button from "../common/Button";
|
|
4
5
|
import Icon from "../common/Icon";
|
|
5
6
|
import { toggleBlock, toggleMark, isMarkActive, addMarkData, isBlockActive, activeMark } from "../utils/SlateUtilityFunctions.js";
|
|
7
|
+
import { fontFamilyMap } from "../utils/font";
|
|
6
8
|
import useFormat from "../utils/customHooks/useFormat.js";
|
|
7
9
|
import defaultToolbarGroups from "./toolbarGroups.js";
|
|
8
10
|
import "./styles.css";
|
|
@@ -17,6 +19,8 @@ import CodeToTextButton from "../Elements/CodeToText/CodeToTextButton";
|
|
|
17
19
|
import HtmlContextMenu from "../Elements/CodeToText/HtmlContextMenu";
|
|
18
20
|
import GridButton from "../Elements/Grid/GridButton";
|
|
19
21
|
import NewLineButton from "../Elements/NewLine/NewLineButton";
|
|
22
|
+
import AccordionButton from "../Elements/Accordion/AccordionButton";
|
|
23
|
+
import SignatureButton from "../Elements/Signature/SignatureButton";
|
|
20
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
26
|
const Toolbar = props => {
|
|
@@ -72,10 +76,20 @@ const Toolbar = props => {
|
|
|
72
76
|
format,
|
|
73
77
|
options
|
|
74
78
|
}) => {
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
const value = activeMark(editor, format);
|
|
80
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
81
|
+
value: value,
|
|
77
82
|
onChange: e => changeMarkData(e, format),
|
|
78
|
-
|
|
83
|
+
style: {
|
|
84
|
+
fontFamily: fontFamilyMap[value],
|
|
85
|
+
width: "200px",
|
|
86
|
+
height: "40px",
|
|
87
|
+
overflow: "hidden"
|
|
88
|
+
},
|
|
89
|
+
children: options.map((item, index) => /*#__PURE__*/_jsx(MenuItem, {
|
|
90
|
+
style: {
|
|
91
|
+
fontFamily: item.text
|
|
92
|
+
},
|
|
79
93
|
value: item.value,
|
|
80
94
|
children: item.text
|
|
81
95
|
}, index))
|
|
@@ -147,6 +161,14 @@ const Toolbar = props => {
|
|
|
147
161
|
return /*#__PURE__*/_jsx(NewLineButton, {
|
|
148
162
|
editor: editor
|
|
149
163
|
}, element.id);
|
|
164
|
+
case "accordion":
|
|
165
|
+
return /*#__PURE__*/_jsx(AccordionButton, {
|
|
166
|
+
editor: editor
|
|
167
|
+
}, element.id);
|
|
168
|
+
case "signature":
|
|
169
|
+
return /*#__PURE__*/_jsx(SignatureButton, {
|
|
170
|
+
editor: editor
|
|
171
|
+
}, element.id);
|
|
150
172
|
default:
|
|
151
173
|
return null;
|
|
152
174
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
+
import { fontOptions } from "../utils/font";
|
|
1
2
|
const toolbarGroups = [[{
|
|
2
3
|
id: 1,
|
|
3
4
|
format: "fontFamily",
|
|
4
5
|
type: "dropdown",
|
|
5
|
-
options:
|
|
6
|
-
text: "Sans Serif",
|
|
7
|
-
value: "sans"
|
|
8
|
-
}, {
|
|
9
|
-
text: "Serif",
|
|
10
|
-
value: "serif"
|
|
11
|
-
}, {
|
|
12
|
-
text: "MonoSpace",
|
|
13
|
-
value: "monospace"
|
|
14
|
-
}]
|
|
6
|
+
options: fontOptions
|
|
15
7
|
}, {
|
|
16
8
|
id: 2,
|
|
17
9
|
format: "fontSize",
|
|
@@ -127,5 +119,11 @@ const toolbarGroups = [[{
|
|
|
127
119
|
}, {
|
|
128
120
|
id: 29,
|
|
129
121
|
type: "newLine"
|
|
122
|
+
}, {
|
|
123
|
+
id: 30,
|
|
124
|
+
type: "accordion"
|
|
125
|
+
}, {
|
|
126
|
+
id: 31,
|
|
127
|
+
type: "signature"
|
|
130
128
|
}]];
|
|
131
129
|
export default toolbarGroups;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Editor, Transforms, Element as SlateElement } from "slate";
|
|
2
|
+
import { fontFamilyMap, sizeMap } from "./font";
|
|
2
3
|
import Link from "../Elements/Link/Link";
|
|
3
4
|
import Image from "../Elements/Embed/Image";
|
|
4
5
|
import Video from "../Elements/Embed/Video";
|
|
@@ -8,20 +9,14 @@ import Table from "../Elements/Table/Table";
|
|
|
8
9
|
import Mentions from "../Elements/Mentions/Mentions";
|
|
9
10
|
import Grid from "../Elements/Grid/Grid";
|
|
10
11
|
import GridItem from "../Elements/Grid/GridItem";
|
|
12
|
+
import Accordion from "../Elements/Accordion/Accordion";
|
|
13
|
+
import AccordionSummary from "../Elements/Accordion/AccordionSummary";
|
|
14
|
+
import AccordionDetails from "../Elements/Accordion/AccordionDetails";
|
|
15
|
+
import Signature from "../Elements/Signature/Signature";
|
|
16
|
+
import Signed from "../Elements/Signature/Signed";
|
|
11
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
18
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
|
13
19
|
const list_types = ["orderedList", "unorderedList"];
|
|
14
|
-
export const sizeMap = {
|
|
15
|
-
small: "0.75em",
|
|
16
|
-
normal: "1em",
|
|
17
|
-
medium: "1.75em",
|
|
18
|
-
huge: "2.5em"
|
|
19
|
-
};
|
|
20
|
-
export const fontFamilyMap = {
|
|
21
|
-
sans: "Helvetica,Arial, sans serif",
|
|
22
|
-
serif: "Georgia, Times New Roaman,serif",
|
|
23
|
-
monospace: "Monaco, Courier New,monospace"
|
|
24
|
-
};
|
|
25
20
|
export const toggleBlock = (editor, format) => {
|
|
26
21
|
const isActive = isBlockActive(editor, format);
|
|
27
22
|
const isList = list_types.includes(format);
|
|
@@ -294,6 +289,26 @@ export const getBlock = props => {
|
|
|
294
289
|
return /*#__PURE__*/_jsx(GridItem, {
|
|
295
290
|
...props
|
|
296
291
|
});
|
|
292
|
+
case "accordion":
|
|
293
|
+
return /*#__PURE__*/_jsx(Accordion, {
|
|
294
|
+
...props
|
|
295
|
+
});
|
|
296
|
+
case "accordion-summary":
|
|
297
|
+
return /*#__PURE__*/_jsx(AccordionSummary, {
|
|
298
|
+
...props
|
|
299
|
+
});
|
|
300
|
+
case "accordion-details":
|
|
301
|
+
return /*#__PURE__*/_jsx(AccordionDetails, {
|
|
302
|
+
...props
|
|
303
|
+
});
|
|
304
|
+
case "signature":
|
|
305
|
+
return /*#__PURE__*/_jsx(Signature, {
|
|
306
|
+
...props
|
|
307
|
+
});
|
|
308
|
+
case "sign":
|
|
309
|
+
return /*#__PURE__*/_jsx(Signed, {
|
|
310
|
+
...props
|
|
311
|
+
});
|
|
297
312
|
default:
|
|
298
313
|
return /*#__PURE__*/_jsx("div", {
|
|
299
314
|
...element.attr,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
export const insertAccordion = editor => {
|
|
3
|
+
const accordion = {
|
|
4
|
+
type: "accordion",
|
|
5
|
+
children: [{
|
|
6
|
+
type: "accordion-summary",
|
|
7
|
+
children: [{
|
|
8
|
+
type: "paragraph",
|
|
9
|
+
children: [{
|
|
10
|
+
text: "Accordion Header"
|
|
11
|
+
}]
|
|
12
|
+
}]
|
|
13
|
+
}, {
|
|
14
|
+
type: "accordion-details",
|
|
15
|
+
children: [{
|
|
16
|
+
type: "paragraph",
|
|
17
|
+
children: [{
|
|
18
|
+
text: "Accordion Content"
|
|
19
|
+
}]
|
|
20
|
+
}]
|
|
21
|
+
}]
|
|
22
|
+
};
|
|
23
|
+
Transforms.insertNodes(editor, accordion);
|
|
24
|
+
Transforms.move(editor);
|
|
25
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const sizeMap = {
|
|
2
|
+
small: "12",
|
|
3
|
+
normal: "16",
|
|
4
|
+
medium: "28",
|
|
5
|
+
huge: "40"
|
|
6
|
+
};
|
|
7
|
+
export const fontFamilyMap = {
|
|
8
|
+
sans: "Helvetica,Arial, sans serif",
|
|
9
|
+
serif: "Georgia, Times New Roaman,serif",
|
|
10
|
+
monospace: "Monaco, Courier New,monospace",
|
|
11
|
+
roboto: "'Roboto', sans-serif",
|
|
12
|
+
qwitcher: "'Qwitcher Grypen', cursive",
|
|
13
|
+
garamond: "'EB Garamond', serif",
|
|
14
|
+
anton: "'Anton', sans-serif",
|
|
15
|
+
dmserif: "'DM Serif Text', serif",
|
|
16
|
+
inter: "'Inter', sans-serif",
|
|
17
|
+
libre: "'Libre Baskerville', serif",
|
|
18
|
+
montserrat: "'Montserrat', sans-serif",
|
|
19
|
+
opensans: "'Open Sans', sans-serif",
|
|
20
|
+
publicsans: "'Public Sans', sans-serif",
|
|
21
|
+
raleway: "'Raleway', sans-serif",
|
|
22
|
+
spacemono: "'Space Mono', sans-serif",
|
|
23
|
+
bulgarian: "'Bulgarian Garamond', monospace",
|
|
24
|
+
impact: "'Impact', serif",
|
|
25
|
+
redacted: "'Redacted Script', cursive",
|
|
26
|
+
greatVibes: "'Great Vibes', cursive",
|
|
27
|
+
zeyada: "'Zeyada', cursive",
|
|
28
|
+
allura: "'Allura', cursive",
|
|
29
|
+
pinyon: "'Pinyon Script', cursive",
|
|
30
|
+
muellerhoff: "'Herr Von Muellerhoff', cursive",
|
|
31
|
+
dawning: "'Dawning of a New Day', cursive",
|
|
32
|
+
//New Font Added for Type Signature
|
|
33
|
+
comingsoon: "'Coming Soon', cursive",
|
|
34
|
+
dancingScript: "'Dancing Script', cursive",
|
|
35
|
+
engagement: "'Engagement', cursive",
|
|
36
|
+
gaegu: "'Gaegu', cursive",
|
|
37
|
+
ingridDarling: "'Ingrid Darling', cursive",
|
|
38
|
+
kitaOne: "'Kite One', sans - serif",
|
|
39
|
+
laBelleAurore: "'La Belle Aurore', cursive",
|
|
40
|
+
lobster: "'Lobster', cursive",
|
|
41
|
+
meaCulpa: "'Mea Culpa', cursive",
|
|
42
|
+
meddon: "'Meddon', cursive",
|
|
43
|
+
merriWeather: "'Merriweather', serif",
|
|
44
|
+
theGirlNextDoor: "'The Girl Next Door', cursive"
|
|
45
|
+
};
|
|
46
|
+
export const fontOptions = Object.keys(fontFamilyMap).map(m => {
|
|
47
|
+
return {
|
|
48
|
+
text: fontFamilyMap[m],
|
|
49
|
+
value: m
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// get last 12 fonts for signature text fonts
|
|
54
|
+
export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
55
|
+
return {
|
|
56
|
+
text: fontFamilyMap[m],
|
|
57
|
+
value: m
|
|
58
|
+
};
|
|
59
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const formatDate = (date, format = "MM/DD/YYYY") => {
|
|
2
|
+
var d = new Date(date),
|
|
3
|
+
month = "" + (d.getMonth() + 1),
|
|
4
|
+
day = "" + d.getDate(),
|
|
5
|
+
year = d.getFullYear();
|
|
6
|
+
if (month.length < 2) month = "0" + month;
|
|
7
|
+
if (day.length < 2) day = "0" + day;
|
|
8
|
+
switch (format) {
|
|
9
|
+
case "MM/DD/YYYY":
|
|
10
|
+
return [month, day, year].join("/");
|
|
11
|
+
case "YYYY-MM-DD":
|
|
12
|
+
return [year, month, day].join("-");
|
|
13
|
+
default:
|
|
14
|
+
return [year, month, day].join("-");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
export const insertSignature = editor => {
|
|
3
|
+
const signature = {
|
|
4
|
+
type: "signature",
|
|
5
|
+
alignment: "center",
|
|
6
|
+
data: {
|
|
7
|
+
name: "",
|
|
8
|
+
email: "",
|
|
9
|
+
date: "" // YYYY-MM-DD
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
size: {
|
|
13
|
+
height: 535,
|
|
14
|
+
widthInPercent: 99.75490196078437,
|
|
15
|
+
width: 1628.000000000001
|
|
16
|
+
},
|
|
17
|
+
children: [{
|
|
18
|
+
text: ""
|
|
19
|
+
}]
|
|
20
|
+
};
|
|
21
|
+
Transforms.insertNodes(editor, signature);
|
|
22
|
+
Transforms.move(editor);
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flozy/editor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "An Editor for flozy app brain",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"interweave": "^13.1.0",
|
|
23
23
|
"lint-staged": "^13.2.3",
|
|
24
24
|
"prettier": "^3.0.1",
|
|
25
|
+
"react-datepicker": "^4.18.0",
|
|
25
26
|
"react-icons": "^4.10.1",
|
|
26
27
|
"react-katex": "^3.0.1",
|
|
27
28
|
"react-scripts": "5.0.1",
|
|
29
|
+
"react-signature-canvas": "^1.0.6",
|
|
28
30
|
"slate": "^0.94.1",
|
|
29
31
|
"slate-history": "^0.93.0",
|
|
30
32
|
"slate-react": "^0.98.3",
|
|
@@ -34,12 +36,12 @@
|
|
|
34
36
|
"yjs": "^13.6.8"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
|
-
"react": ">=
|
|
38
|
-
"react-dom": ">=
|
|
39
|
+
"react": ">=16.0.0",
|
|
40
|
+
"react-dom": ">=16.0.0"
|
|
39
41
|
},
|
|
40
42
|
"scripts": {
|
|
41
43
|
"prepare": "husky install .husky",
|
|
42
|
-
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore .
|
|
44
|
+
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore .",
|
|
43
45
|
"start": "craco start",
|
|
44
46
|
"build": "craco build",
|
|
45
47
|
"test": "craco test --passWithNoTests",
|
|
@@ -115,7 +117,12 @@
|
|
|
115
117
|
},
|
|
116
118
|
"babel": {
|
|
117
119
|
"presets": [
|
|
118
|
-
[
|
|
120
|
+
[
|
|
121
|
+
"@babel/preset-react",
|
|
122
|
+
{
|
|
123
|
+
"runtime": "automatic"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
119
126
|
]
|
|
120
127
|
}
|
|
121
128
|
}
|