@griddo/ax 11.5.0 → 11.5.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "11.5.0",
4
+ "version": "11.5.1",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -224,5 +224,5 @@
224
224
  "publishConfig": {
225
225
  "access": "public"
226
226
  },
227
- "gitHead": "cf3db6035618b29bb1bf2a0b650e8be3199605ad"
227
+ "gitHead": "a2bb818ce6e0cfc4ac1c83d7a2925da433a908f8"
228
228
  }
@@ -2,12 +2,25 @@ import React, { memo } from "react";
2
2
 
3
3
  import { FieldsBehavior } from "@ax/components";
4
4
  import { ILinkField, IUrlField } from "@ax/types";
5
+ import { getNullValue } from "@ax/helpers";
5
6
 
6
7
  const LinkField = (props: ILinkFieldProps): JSX.Element => {
7
8
  const { value, onChange, disabled, whiteList, goTo, theme, actions, selectedContent, objKey } = props;
8
9
 
9
10
  const handleTextChange = (newValue: string) => onChange({ ...value, text: newValue });
10
- const handleLinkTypeChange = (newValue: string) => onChange({ ...value, linkType: newValue });
11
+ const handleLinkTypeChange = (newValue: string) => {
12
+ let newObjValue: ILinkField = { ...value, linkType: newValue };
13
+
14
+ if (newValue === "url") {
15
+ newObjValue = { ...newObjValue, modal: getNullValue(newObjValue.modal, true) };
16
+ }
17
+
18
+ if (newValue === "modal") {
19
+ newObjValue = { ...newObjValue, url: null };
20
+ }
21
+
22
+ onChange(newObjValue);
23
+ };
11
24
  const handleUrlChange = (newValue: IUrlField) => onChange({ ...value, url: newValue });
12
25
  const handleModalChange = (newValue: any) => onChange({ ...value, modal: newValue });
13
26
 
@@ -63,14 +63,15 @@ const getImageFromHtml = async (html: HTMLDivElement, fileName: string): Promise
63
63
 
64
64
  const getImageFromIFrame = async (html: HTMLDivElement, fileName: string): Promise<File | null> => {
65
65
  const frameOBject = html.querySelector<HTMLIFrameElement>(".frame-content");
66
- const frameContent = frameOBject?.contentWindow?.document.body;
66
+ const frameContentFirst = frameOBject?.contentWindow?.document.getElementById("___griddo")?.firstChild as HTMLElement;
67
+ const frameContentId = frameOBject?.contentWindow?.document.getElementById("griddoFormThumb") as HTMLElement;
68
+
69
+ const frameContent = frameContentId || frameContentFirst;
67
70
 
68
71
  if (!frameContent) {
69
72
  return null;
70
73
  }
71
74
 
72
- frameContent.removeChild(frameContent.childNodes[1]);
73
-
74
75
  const { height } = getComputedStyle(frameContent);
75
76
  const fullHeight = frameContent?.scrollHeight;
76
77
 
@@ -924,7 +924,7 @@ export interface INotification {
924
924
  export interface ILinkField {
925
925
  text: string;
926
926
  linkType: string;
927
- url: IUrlField;
927
+ url?: IUrlField | null;
928
928
  modal: any;
929
929
  }
930
930