@flozy/editor 3.3.0 → 3.3.1

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.
@@ -1,16 +1,9 @@
1
1
  export const validationMethods = {
2
2
  isEmail: value => {
3
- const regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; //eslint-disable-line
4
- const result = regex.test(String(value).toLowerCase());
5
- if (result) {
6
- let domain = String(value).toLowerCase().split('@')[1];
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: title,
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 || "Home",
81
+ label: page?.label,
82
82
  setValue: val => onChange(val?.value),
83
83
  placeholder: "Select Page",
84
84
  options: pages
@@ -33,7 +33,7 @@ const appHeaderStyle = [{
33
33
  key: "appLogo",
34
34
  type: "text"
35
35
  }, {
36
- label: "App Logo Height",
36
+ label: "Logo Height",
37
37
  key: "logoHeight",
38
38
  type: "text",
39
39
  placeholder: "40px"
@@ -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.split("#");
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}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"