@flozy/editor 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,9 @@
|
|
1
1
|
export const validationMethods = {
|
2
2
|
isEmail: value => {
|
3
|
-
const regex = /^([
|
4
|
-
const
|
5
|
-
if (
|
6
|
-
|
7
|
-
let validExtensions = ['com', 'net', 'org', 'edu'];
|
8
|
-
let extension = domain.split('.').pop();
|
9
|
-
if (validExtensions.includes(extension)) {
|
10
|
-
return "";
|
11
|
-
} else {
|
12
|
-
return "Enter valid email address";
|
13
|
-
}
|
3
|
+
const regex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
4
|
+
const isValidEmail = regex.test(String(value).toLowerCase());
|
5
|
+
if (isValidEmail) {
|
6
|
+
return "";
|
14
7
|
} else {
|
15
8
|
return "Enter valid email address";
|
16
9
|
}
|
@@ -51,7 +51,7 @@ export const SelectPage = props => {
|
|
51
51
|
...rest
|
52
52
|
} = r;
|
53
53
|
return {
|
54
|
-
label:
|
54
|
+
label: url_name,
|
55
55
|
value: url_name,
|
56
56
|
...rest
|
57
57
|
};
|
@@ -78,7 +78,7 @@ export const SelectPage = props => {
|
|
78
78
|
}, [value, pages]);
|
79
79
|
return /*#__PURE__*/_jsxs("div", {
|
80
80
|
children: [/*#__PURE__*/_jsx(FreeSoloCreateOption, {
|
81
|
-
label: page?.label
|
81
|
+
label: page?.label,
|
82
82
|
setValue: val => onChange(val?.value),
|
83
83
|
placeholder: "Select Page",
|
84
84
|
options: pages
|
@@ -214,6 +214,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
214
214
|
component: "button"
|
215
215
|
};
|
216
216
|
}
|
217
|
+
if (!linkType && url) {
|
218
|
+
if (url?.includes("http")) {
|
219
|
+
linkType = "webAddress";
|
220
|
+
} else {
|
221
|
+
linkType = "page";
|
222
|
+
}
|
223
|
+
}
|
217
224
|
switch (linkType) {
|
218
225
|
case "webAddress":
|
219
226
|
const refUrl = url ? url.includes("http") ? url : `//${url}` : "Link";
|
@@ -236,7 +243,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
236
243
|
break;
|
237
244
|
case "page":
|
238
245
|
props.component = "a";
|
239
|
-
const [page, section] = url
|
246
|
+
const [page, section] = url?.split("#") || [];
|
240
247
|
const sec = section ? `#${section}` : "";
|
241
248
|
const isHome = page === "home" || !page;
|
242
249
|
props.href = isHome ? `${sec}` : `/${url}`;
|