@flozy/editor 1.9.7 → 1.9.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +2 -6
- package/dist/Editor/DialogWrapper.js +3 -0
- package/dist/Editor/Editor.css +0 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
- package/dist/Editor/Elements/Button/EditorButton.js +43 -38
- package/dist/Editor/Elements/Embed/Image.js +1 -1
- package/dist/Editor/Elements/Form/Form.js +36 -3
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +59 -0
- package/dist/Editor/Elements/Form/FormElements/index.js +2 -1
- package/dist/Editor/Elements/Form/FormElements/validations.js +35 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +8 -3
- package/dist/Editor/Elements/SimpleText.js +2 -2
- package/dist/Editor/Styles/EditorStyles.js +6 -1
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +12 -3
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +7 -1
- package/dist/Editor/common/ColorPickerButton.js +1 -1
- package/dist/Editor/common/Icon.js +5 -3
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +5 -0
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/commonStyle.js +33 -0
- package/dist/Editor/helper/index.js +3 -3
- package/dist/Editor/utils/formfield.js +1 -0
- package/dist/Editor/utils/pageSettings.js +18 -0
- package/package.json +1 -1
@@ -13,7 +13,7 @@ import { mentionsEvent, commands, indentation, escapeEvent, enterEvent } from ".
|
|
13
13
|
import withCommon from "./hooks/withCommon";
|
14
14
|
import DialogWrapper from "./DialogWrapper";
|
15
15
|
import { serializeToText } from "./utils/serializeToText";
|
16
|
-
import {
|
16
|
+
import { focusOnFirstParagraph, getPageSettings } from "./utils/pageSettings";
|
17
17
|
import { getThumbnailImage, invertColor } from "./helper";
|
18
18
|
import PopupTool from "./Toolbar/PopupTool";
|
19
19
|
import "./font.css";
|
@@ -25,7 +25,6 @@ import { EditorProvider } from "./hooks/useMouseMove";
|
|
25
25
|
import TopBanner from "./Elements/TopBanner/TopBanner";
|
26
26
|
import editorStyles from "./Styles/EditorStyles";
|
27
27
|
import DragAndDrop from "./common/DnD";
|
28
|
-
import DragHandle from "./common/DnD/DragHandle";
|
29
28
|
import Section from "./common/Section";
|
30
29
|
import "animate.css";
|
31
30
|
import decorators from "./utils/Decorators";
|
@@ -139,10 +138,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
139
138
|
setValue(draftToSlate({
|
140
139
|
data: content
|
141
140
|
}));
|
142
|
-
|
143
|
-
path: [0, 0],
|
144
|
-
offset: 0
|
145
|
-
});
|
141
|
+
focusOnFirstParagraph(editor);
|
146
142
|
}, [id, content]);
|
147
143
|
useEffect(() => {
|
148
144
|
if (editorWrapper && editorWrapper?.current && JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
package/dist/Editor/Editor.css
CHANGED
@@ -93,9 +93,9 @@ const Accordion = props => {
|
|
93
93
|
style: {
|
94
94
|
backgroundColor: bgColor
|
95
95
|
},
|
96
|
+
onClick: onToggle,
|
96
97
|
children: [/*#__PURE__*/_jsx(IconButton, {
|
97
98
|
className: "accordion-summary-collapse-btn",
|
98
|
-
onClick: onToggle,
|
99
99
|
contentEditable: false,
|
100
100
|
sx: {
|
101
101
|
"& svg": {
|
@@ -154,46 +154,51 @@ const EditorButton = props => {
|
|
154
154
|
style: {
|
155
155
|
display: "inline"
|
156
156
|
},
|
157
|
-
children: /*#__PURE__*/_jsxs(
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
display: "
|
177
|
-
|
178
|
-
|
179
|
-
color: `${textColorHover || textColor || "#FFFFFF"}`,
|
180
|
-
background: bgColorHover || bgColor || "rgb(30, 75, 122)",
|
157
|
+
children: /*#__PURE__*/_jsxs("span", {
|
158
|
+
style: {
|
159
|
+
position: "relative"
|
160
|
+
},
|
161
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
162
|
+
component: "button",
|
163
|
+
sx: {
|
164
|
+
background: bgColor || "rgb(30, 75, 122)",
|
165
|
+
borderBlockStyle: "solid",
|
166
|
+
borderColor: borderColor || "transparent",
|
167
|
+
borderWidth: borderWidth || "1px",
|
168
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
169
|
+
borderStyle: borderStyle || "solid",
|
170
|
+
padding: {
|
171
|
+
...getTRBLBreakPoints(bannerSpacing)
|
172
|
+
},
|
173
|
+
color: `${textColor || "#FFFFFF"}`,
|
174
|
+
fontSize: textSize || "inherit",
|
175
|
+
fontFamily: fontFamily || "PoppinsRegular",
|
176
|
+
display: "inline-flex",
|
177
|
+
alignItems: "center",
|
178
|
+
position: "relative",
|
181
179
|
"& .element-toolbar": {
|
182
|
-
display: "
|
180
|
+
display: "none"
|
181
|
+
},
|
182
|
+
"&:hover": {
|
183
|
+
color: `${textColorHover || textColor || "#FFFFFF"}`,
|
184
|
+
background: bgColorHover || bgColor || "rgb(30, 75, 122)",
|
185
|
+
"& .element-toolbar": {
|
186
|
+
display: "block"
|
187
|
+
}
|
183
188
|
}
|
184
|
-
}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
}
|
189
|
+
},
|
190
|
+
onClick: onClick,
|
191
|
+
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(BtnIcon, {
|
192
|
+
style: {
|
193
|
+
paddingLeft: "4px",
|
194
|
+
paddingRight: "4px"
|
195
|
+
}
|
196
|
+
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(BtnIcon, {
|
197
|
+
style: {
|
198
|
+
paddingLeft: "4px",
|
199
|
+
paddingRight: "4px"
|
200
|
+
}
|
201
|
+
})]
|
197
202
|
}), !readOnly && isTrigger ? /*#__PURE__*/_jsx(IconButton, {
|
198
203
|
className: "workflow-icon-btn",
|
199
204
|
children: /*#__PURE__*/_jsx(WorkflowIcon, {})
|
@@ -12,6 +12,7 @@ import { formSubmit } from "../../service/formSubmit";
|
|
12
12
|
import formButtonStyle from "../../common/StyleBuilder/formButtonStyle";
|
13
13
|
import Workflow from "./Workflow";
|
14
14
|
import { getTRBLBreakPoints } from "../../helper/theme";
|
15
|
+
import { validation } from "./FormElements/validations";
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
17
18
|
const Form = props => {
|
@@ -40,7 +41,6 @@ const Form = props => {
|
|
40
41
|
fontFamily,
|
41
42
|
textAlign
|
42
43
|
} = element;
|
43
|
-
const isEmail = element?.children[0].element === "email";
|
44
44
|
const {
|
45
45
|
topLeft,
|
46
46
|
topRight,
|
@@ -66,6 +66,9 @@ const Form = props => {
|
|
66
66
|
} : {
|
67
67
|
borderColor: buttonProps?.borderColor || "none"
|
68
68
|
};
|
69
|
+
const getFieldProps = (key = '', val = '') => {
|
70
|
+
return element?.children?.find(obj => obj && obj[key] === val);
|
71
|
+
};
|
69
72
|
const handleSubmit = async (event, test = false) => {
|
70
73
|
if (event) {
|
71
74
|
event.preventDefault();
|
@@ -74,7 +77,29 @@ const Form = props => {
|
|
74
77
|
const formData = new FormData(formEle?.current);
|
75
78
|
setLoading(true);
|
76
79
|
let response = {};
|
80
|
+
const emailObject = getFieldProps('field_type', 'email');
|
81
|
+
let user_email = '';
|
82
|
+
const validations = [];
|
77
83
|
for (let pair of formData.entries()) {
|
84
|
+
if (emailObject?.name === pair[0]) {
|
85
|
+
user_email = pair[1];
|
86
|
+
}
|
87
|
+
const fieldData = getFieldProps('name', pair[0]);
|
88
|
+
let rule = [];
|
89
|
+
if (fieldData?.required) {
|
90
|
+
rule.push(`isRequired`);
|
91
|
+
}
|
92
|
+
if (fieldData?.field_type === "email") {
|
93
|
+
rule.push(`isEmail`);
|
94
|
+
}
|
95
|
+
if (fieldData?.required || fieldData?.field_type === 'email') {
|
96
|
+
validations.push({
|
97
|
+
name: pair[0],
|
98
|
+
value: pair[1],
|
99
|
+
field_type: fieldData?.field_type,
|
100
|
+
rules: rule && rule
|
101
|
+
});
|
102
|
+
}
|
78
103
|
response = {
|
79
104
|
...response,
|
80
105
|
[pair[0]]: pair[1]
|
@@ -83,14 +108,22 @@ const Form = props => {
|
|
83
108
|
let params = {
|
84
109
|
page_id: page_id,
|
85
110
|
form_id: `${formName}`,
|
86
|
-
response
|
111
|
+
response: {
|
112
|
+
...response
|
113
|
+
},
|
87
114
|
form_data: {
|
115
|
+
user_email: user_email,
|
88
116
|
email: element?.email,
|
89
117
|
form_workflow: element?.workflow,
|
90
118
|
save_response: element?.saveResponse
|
91
119
|
}
|
92
120
|
};
|
93
|
-
|
121
|
+
const isValidForm = validations.length !== 0 && validation(validations);
|
122
|
+
if (isValidForm) {
|
123
|
+
alert(isValidForm[0]);
|
124
|
+
} else {
|
125
|
+
await formSubmit(params, customProps);
|
126
|
+
}
|
94
127
|
setLoading(false);
|
95
128
|
}
|
96
129
|
};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { getTRBLBreakPoints } from "../../../helper/theme";
|
3
|
+
import { Box } from "@mui/material";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const FormEmail = props => {
|
6
|
+
const {
|
7
|
+
fieldProps
|
8
|
+
} = props;
|
9
|
+
const {
|
10
|
+
bannerSpacing,
|
11
|
+
height,
|
12
|
+
borderRadius,
|
13
|
+
borderStyle,
|
14
|
+
borderWidth,
|
15
|
+
borderColor,
|
16
|
+
textColor,
|
17
|
+
bgColor,
|
18
|
+
lockSpacing,
|
19
|
+
...rest
|
20
|
+
} = fieldProps;
|
21
|
+
const {
|
22
|
+
topLeft,
|
23
|
+
topRight,
|
24
|
+
bottomLeft,
|
25
|
+
bottomRight
|
26
|
+
} = borderRadius || {};
|
27
|
+
const onChange = e => {
|
28
|
+
e.preventDefault();
|
29
|
+
};
|
30
|
+
return /*#__PURE__*/_jsx("div", {
|
31
|
+
style: {
|
32
|
+
width: "100%",
|
33
|
+
display: "flex"
|
34
|
+
},
|
35
|
+
contentEditable: false,
|
36
|
+
children: /*#__PURE__*/_jsx(Box, {
|
37
|
+
component: "input",
|
38
|
+
type: "email",
|
39
|
+
required: true,
|
40
|
+
...rest,
|
41
|
+
onChange: onChange,
|
42
|
+
sx: {
|
43
|
+
width: "100%",
|
44
|
+
border: `1px solid ${borderColor || "#FFF"}`,
|
45
|
+
padding: {
|
46
|
+
...getTRBLBreakPoints(bannerSpacing)
|
47
|
+
},
|
48
|
+
height: height || "auto",
|
49
|
+
borderColor: borderColor || "transparent",
|
50
|
+
borderWidth: borderWidth || "1px",
|
51
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
52
|
+
borderStyle: borderStyle || "solid",
|
53
|
+
color: textColor || "#000",
|
54
|
+
background: bgColor || "transparent"
|
55
|
+
}
|
56
|
+
})
|
57
|
+
});
|
58
|
+
};
|
59
|
+
export default FormEmail;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { bool } from "prop-types";
|
2
|
+
export const validationMethods = {
|
3
|
+
isEmail: value => {
|
4
|
+
const regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
5
|
+
const result = regex.test(String(value).toLowerCase());
|
6
|
+
if (result) {
|
7
|
+
let domain = String(value).toLowerCase().split('@')[1];
|
8
|
+
let validExtensions = ['com', 'net', 'org', 'edu'];
|
9
|
+
let extension = domain.split('.').pop();
|
10
|
+
if (validExtensions.includes(extension)) {
|
11
|
+
return "";
|
12
|
+
} else {
|
13
|
+
return "Enter valid email address";
|
14
|
+
}
|
15
|
+
} else {
|
16
|
+
return "Enter valid email address";
|
17
|
+
}
|
18
|
+
},
|
19
|
+
isRequired: value => {
|
20
|
+
return value === '' ? "Required fields should not be empty" : "";
|
21
|
+
}
|
22
|
+
};
|
23
|
+
export const validation = fields => {
|
24
|
+
let validated = [];
|
25
|
+
let filedValue = [];
|
26
|
+
fields.map(field => {
|
27
|
+
let val = field.rules.map(vm => {
|
28
|
+
return validationMethods[vm](field["value"]);
|
29
|
+
});
|
30
|
+
return filedValue.push(...val);
|
31
|
+
});
|
32
|
+
validated.push(...filedValue);
|
33
|
+
validated = validated.filter(val => val !== "");
|
34
|
+
return validated.length === 0 ? false : validated;
|
35
|
+
};
|
@@ -6,13 +6,17 @@ import "react-datepicker/dist/react-datepicker.css";
|
|
6
6
|
import SignatureOptions from "./SignatureOptions";
|
7
7
|
import "./Signature.css";
|
8
8
|
import { DrawSignature, PencilIcon, TypeSignature, UploadSignature } from "../../common/EditorIcons";
|
9
|
-
import
|
10
|
-
import {
|
9
|
+
import useCommonStyle from "../../commonStyle";
|
10
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
14
14
|
const BrushSizes = [1, 5, 7];
|
15
15
|
const SignaturePopup = props => {
|
16
|
+
const {
|
17
|
+
theme
|
18
|
+
} = useEditorContext();
|
19
|
+
const classes = useCommonStyle(theme);
|
16
20
|
const {
|
17
21
|
onSave,
|
18
22
|
onClear,
|
@@ -110,6 +114,7 @@ const SignaturePopup = props => {
|
|
110
114
|
open: open,
|
111
115
|
onClose: handleClose,
|
112
116
|
fullWidth: true,
|
117
|
+
sx: classes.signaturePopup,
|
113
118
|
children: /*#__PURE__*/_jsx(Grid, {
|
114
119
|
container: true,
|
115
120
|
children: /*#__PURE__*/_jsxs(Grid, {
|
@@ -370,4 +375,4 @@ const SignaturePopup = props => {
|
|
370
375
|
};
|
371
376
|
|
372
377
|
// export default SignaturePopup;
|
373
|
-
export default
|
378
|
+
export default SignaturePopup;
|
@@ -48,7 +48,7 @@ const SimpleTextStyle = ({
|
|
48
48
|
const SimpleText = props => {
|
49
49
|
const {
|
50
50
|
theme
|
51
|
-
} = useEditorContext();
|
51
|
+
} = useEditorContext() || {};
|
52
52
|
const editor = useSlateStatic();
|
53
53
|
const {
|
54
54
|
element,
|
@@ -68,7 +68,7 @@ const SimpleText = props => {
|
|
68
68
|
pageColor
|
69
69
|
} = pageSt?.pageProps || {};
|
70
70
|
const classes = SimpleTextStyle({
|
71
|
-
pageColor: pageColor || theme?.palette?.editor?.background
|
71
|
+
pageColor: pageColor || theme?.palette?.editor?.background || '#FFFFFF'
|
72
72
|
});
|
73
73
|
const selected = useSelected();
|
74
74
|
const path = ReactEditor.findPath(editor, element);
|
@@ -30,7 +30,12 @@ const editorStyles = ({
|
|
30
30
|
color: "#0f172a",
|
31
31
|
"&.no-color": {
|
32
32
|
backgroundColor: theme?.palette?.editor?.background,
|
33
|
-
color: theme?.palette?.editor?.textColor
|
33
|
+
color: theme?.palette?.editor?.textColor,
|
34
|
+
"& .signed-btn": {
|
35
|
+
"& img": {
|
36
|
+
backgroundColor: "#FFF"
|
37
|
+
}
|
38
|
+
}
|
34
39
|
},
|
35
40
|
"& .max-content": {
|
36
41
|
width: "100%",
|
@@ -107,8 +107,8 @@ const AddTemplates = props => {
|
|
107
107
|
case "Starter":
|
108
108
|
case "Proposal":
|
109
109
|
case "Page":
|
110
|
+
case "Brief":
|
110
111
|
case "Contract":
|
111
|
-
case "404 Page":
|
112
112
|
return /*#__PURE__*/_jsx(TemplateCard, {
|
113
113
|
classes: classes,
|
114
114
|
onSelectTemplate: onSelectTemplate,
|
@@ -128,10 +128,19 @@ const AddTemplates = props => {
|
|
128
128
|
classes: classes,
|
129
129
|
onSelectTemplate: onSelectTemplate,
|
130
130
|
m: mapData,
|
131
|
-
fullScreen: fullScreen
|
131
|
+
fullScreen: fullScreen,
|
132
|
+
height: "smallCard"
|
133
|
+
}, `template_Card_${mapData.id}_popup`);
|
134
|
+
case "404 Page":
|
135
|
+
return /*#__PURE__*/_jsx(FullViewCard, {
|
136
|
+
classes: classes,
|
137
|
+
onSelectTemplate: onSelectTemplate,
|
138
|
+
m: mapData,
|
139
|
+
fullScreen: fullScreen,
|
140
|
+
height: "mediumCard"
|
132
141
|
}, `template_Card_${mapData.id}_popup`);
|
133
142
|
default:
|
134
|
-
/*#__PURE__*/_jsx(TemplateCard, {
|
143
|
+
return /*#__PURE__*/_jsx(TemplateCard, {
|
135
144
|
classes: classes,
|
136
145
|
onSelectTemplate: onSelectTemplate,
|
137
146
|
m: mapData,
|
@@ -26,7 +26,8 @@ const FullViewCard = props => {
|
|
26
26
|
const {
|
27
27
|
classes,
|
28
28
|
m,
|
29
|
-
onSelectTemplate
|
29
|
+
onSelectTemplate,
|
30
|
+
height = 'smallCard'
|
30
31
|
} = props;
|
31
32
|
return /*#__PURE__*/_jsx(Grid, {
|
32
33
|
item: true,
|
@@ -40,7 +41,8 @@ const FullViewCard = props => {
|
|
40
41
|
component: "div",
|
41
42
|
image: m?.thumbnail,
|
42
43
|
alt: m?.title,
|
43
|
-
sx: classes.fullViewCardMedia
|
44
|
+
sx: classes.fullViewCardMedia,
|
45
|
+
className: height
|
44
46
|
}), /*#__PURE__*/_jsx(Select, {
|
45
47
|
classes: classes,
|
46
48
|
onSelectTemplate: onSelectTemplate,
|
@@ -376,13 +376,19 @@ const usePopupStyle = theme => ({
|
|
376
376
|
},
|
377
377
|
fullViewCardMedia: {
|
378
378
|
width: "100%",
|
379
|
-
height: "130px",
|
380
379
|
backgroundPosition: "left top",
|
381
380
|
backgroundSize: "100% auto",
|
382
381
|
zIndex: 1,
|
383
382
|
position: "relative",
|
384
383
|
"&.fullscreen": {
|
385
384
|
height: "130px"
|
385
|
+
},
|
386
|
+
"&.smallCard": {
|
387
|
+
height: "130px"
|
388
|
+
},
|
389
|
+
"&.mediumCard": {
|
390
|
+
height: "250px",
|
391
|
+
boxShadow: "0px 1px 3px 3px rgba(0,0,0,0.12)"
|
386
392
|
}
|
387
393
|
},
|
388
394
|
buttonCardMedia: {
|
@@ -6,8 +6,10 @@ import { FcAddRow, FcAddColumn } from "react-icons/fc";
|
|
6
6
|
import { AiFillEdit, AiOutlineInsertRowBelow, AiOutlineInsertRowRight, AiOutlineDelete, AiFillTag, AiOutlineUpload, AiOutlineArrowsAlt, AiOutlineInsertRowAbove, AiOutlineInsertRowLeft, AiFillHtml5 } from "react-icons/ai";
|
7
7
|
import { SiLatex } from "react-icons/si";
|
8
8
|
import { RiDeleteColumn, RiDeleteRow } from "react-icons/ri";
|
9
|
-
import { IoIosImage
|
9
|
+
import { IoIosImage } from "react-icons/io";
|
10
10
|
import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage, DocsUpload, LeftArrow, RightArrow, CheckListButton, CheckListButtonActive, ExcelIcon, CsvIcon, DividerIcon } from "./iconslist";
|
11
|
+
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
12
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
11
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
15
|
const iconList = {
|
@@ -175,10 +177,10 @@ const iconList = {
|
|
175
177
|
media: /*#__PURE__*/_jsx(MdOutlinePermMedia, {
|
176
178
|
size: 20
|
177
179
|
}),
|
178
|
-
accordionArrow: /*#__PURE__*/_jsx(
|
180
|
+
accordionArrow: /*#__PURE__*/_jsx(ArrowRightIcon, {
|
179
181
|
size: 20
|
180
182
|
}),
|
181
|
-
accordionArrowDown: /*#__PURE__*/_jsx(
|
183
|
+
accordionArrowDown: /*#__PURE__*/_jsx(ArrowDropDownIcon, {
|
182
184
|
size: 20
|
183
185
|
}),
|
184
186
|
appHeader: /*#__PURE__*/_jsx(AppHeader, {}),
|
@@ -50,6 +50,39 @@ const useCommonStyle = theme => ({
|
|
50
50
|
color: theme?.palette?.editor?.textColor
|
51
51
|
}
|
52
52
|
}
|
53
|
+
},
|
54
|
+
signaturePopup: {
|
55
|
+
"& .MuiPaper-root": {
|
56
|
+
backgroundColor: theme?.palette?.editor?.background,
|
57
|
+
"& .signature-canvas": {
|
58
|
+
backgroundColor: "#FFF"
|
59
|
+
},
|
60
|
+
"& label": {
|
61
|
+
color: theme?.palette?.editor?.textColor
|
62
|
+
},
|
63
|
+
"& input": {
|
64
|
+
color: theme?.palette?.editor?.textColor,
|
65
|
+
backgroundColor: theme?.palette?.editor?.background
|
66
|
+
},
|
67
|
+
"& .react-datepicker__input-container": {
|
68
|
+
"& svg": {
|
69
|
+
fill: theme?.palette?.editor?.textColor
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"& fieldset": {
|
73
|
+
borderColor: theme?.palette?.editor?.textColor
|
74
|
+
},
|
75
|
+
"& .upload-wrapper-ui": {
|
76
|
+
"& .MuiTypography-root": {
|
77
|
+
color: theme?.palette?.editor?.textColor
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"& .typesignature-fontfamily": {
|
81
|
+
"& button": {
|
82
|
+
color: theme?.palette?.editor?.textColor
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
53
86
|
}
|
54
87
|
});
|
55
88
|
export default useCommonStyle;
|
@@ -36,14 +36,14 @@ export function invertColor(hex) {
|
|
36
36
|
if (hex?.indexOf("#") === -1) {
|
37
37
|
hex = rgbToHex(hex);
|
38
38
|
}
|
39
|
-
if (hex
|
39
|
+
if (hex?.indexOf("#") === 0) {
|
40
40
|
hex = hex.slice(1);
|
41
41
|
}
|
42
42
|
// convert 3-digit hex to 6-digits.
|
43
|
-
if (hex
|
43
|
+
if (hex?.length === 3) {
|
44
44
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
45
45
|
}
|
46
|
-
if (hex
|
46
|
+
if (hex?.length !== 6) {
|
47
47
|
// throw new Error("Invalid HEX color.");
|
48
48
|
}
|
49
49
|
// invert color components
|
@@ -81,4 +81,22 @@ export const updatePageSettings = (editor, pageProps = {}) => {
|
|
81
81
|
} catch (err) {
|
82
82
|
console.log(err);
|
83
83
|
}
|
84
|
+
};
|
85
|
+
export const focusOnFirstParagraph = editor => {
|
86
|
+
try {
|
87
|
+
const [paragraphNode] = Editor.nodes(editor, {
|
88
|
+
at: [],
|
89
|
+
match: n => {
|
90
|
+
return !Editor.isEditor(n) && Element.isElement(n) && n.text !== undefined && !n.type;
|
91
|
+
}
|
92
|
+
});
|
93
|
+
if (paragraphNode && paragraphNode[1] !== undefined) {
|
94
|
+
Transforms.select(editor, {
|
95
|
+
path: paragraphNode[1],
|
96
|
+
offset: 0
|
97
|
+
});
|
98
|
+
}
|
99
|
+
} catch (err) {
|
100
|
+
console.log(err);
|
101
|
+
}
|
84
102
|
};
|