@iframe-resizer/react 5.2.5 → 5.3.0-beta.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/README.md +1 -1
- package/index.cjs.js +10 -9
- package/index.esm.js +10 -9
- package/package.json +3 -4
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/react 5.
|
|
4
|
+
* @module iframe-resizer/react 5.3.0-beta.1 (cjs) - 2024-09-01
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
const _extends = require('@babel/runtime/helpers/extends');
|
|
23
23
|
const connectResizer = require('@iframe-resizer/core');
|
|
24
24
|
const React = require('react');
|
|
25
|
-
const warning = require('warning');
|
|
26
25
|
|
|
27
|
-
const filterIframeAttribs =
|
|
26
|
+
const filterIframeAttribs = props => {
|
|
28
27
|
const {
|
|
29
28
|
license,
|
|
30
29
|
bodyBackground,
|
|
@@ -48,19 +47,21 @@ const filterIframeAttribs = (props => {
|
|
|
48
47
|
...iframeProps
|
|
49
48
|
} = props;
|
|
50
49
|
return iframeProps;
|
|
51
|
-
}
|
|
50
|
+
};
|
|
52
51
|
|
|
52
|
+
// TODO: Add support for React.forwardRef() in next major version (Breaking change)
|
|
53
53
|
function IframeResizer(props) {
|
|
54
54
|
// eslint-disable-next-line react/prop-types
|
|
55
55
|
const {
|
|
56
|
-
title,
|
|
57
56
|
forwardRef,
|
|
58
57
|
...rest
|
|
59
58
|
} = props;
|
|
60
59
|
const filteredProps = filterIframeAttribs(rest);
|
|
61
60
|
const iframeRef = React.useRef(null);
|
|
62
61
|
const onClose = () => {
|
|
63
|
-
|
|
62
|
+
if (!iframeRef.current)
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
console.warn(`[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
|
|
64
65
|
return !iframeRef.current; // Allow React to close this
|
|
65
66
|
};
|
|
66
67
|
|
|
@@ -84,9 +85,9 @@ function IframeResizer(props) {
|
|
|
84
85
|
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
85
86
|
}
|
|
86
87
|
}));
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}, filteredProps, {
|
|
88
|
+
|
|
89
|
+
// eslint-disable-next-line jsx-a11y/iframe-has-title
|
|
90
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, filteredProps, {
|
|
90
91
|
ref: iframeRef
|
|
91
92
|
}));
|
|
92
93
|
}
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/react 5.
|
|
4
|
+
* @module iframe-resizer/react 5.3.0-beta.1 (esm) - 2024-09-01
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
import _extends from '@babel/runtime/helpers/extends';
|
|
21
21
|
import connectResizer from '@iframe-resizer/core';
|
|
22
22
|
import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
23
|
-
import warning from 'warning';
|
|
24
23
|
|
|
25
|
-
const filterIframeAttribs =
|
|
24
|
+
const filterIframeAttribs = props => {
|
|
26
25
|
const {
|
|
27
26
|
license,
|
|
28
27
|
bodyBackground,
|
|
@@ -46,19 +45,21 @@ const filterIframeAttribs = (props => {
|
|
|
46
45
|
...iframeProps
|
|
47
46
|
} = props;
|
|
48
47
|
return iframeProps;
|
|
49
|
-
}
|
|
48
|
+
};
|
|
50
49
|
|
|
50
|
+
// TODO: Add support for React.forwardRef() in next major version (Breaking change)
|
|
51
51
|
function IframeResizer(props) {
|
|
52
52
|
// eslint-disable-next-line react/prop-types
|
|
53
53
|
const {
|
|
54
|
-
title,
|
|
55
54
|
forwardRef,
|
|
56
55
|
...rest
|
|
57
56
|
} = props;
|
|
58
57
|
const filteredProps = filterIframeAttribs(rest);
|
|
59
58
|
const iframeRef = useRef(null);
|
|
60
59
|
const onClose = () => {
|
|
61
|
-
|
|
60
|
+
if (!iframeRef.current)
|
|
61
|
+
// eslint-disable-next-line no-console
|
|
62
|
+
console.warn(`[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
|
|
62
63
|
return !iframeRef.current; // Allow React to close this
|
|
63
64
|
};
|
|
64
65
|
|
|
@@ -82,9 +83,9 @@ function IframeResizer(props) {
|
|
|
82
83
|
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
83
84
|
}
|
|
84
85
|
}));
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, filteredProps, {
|
|
86
|
+
|
|
87
|
+
// eslint-disable-next-line jsx-a11y/iframe-has-title
|
|
88
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, filteredProps, {
|
|
88
89
|
ref: iframeRef
|
|
89
90
|
}));
|
|
90
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-beta.1",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"homepage": "https://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"react"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@babel/runtime": "^7.25.
|
|
47
|
-
"@iframe-resizer/core": "5.
|
|
48
|
-
"warning": "^4.0.3"
|
|
46
|
+
"@babel/runtime": "^7.25.6",
|
|
47
|
+
"@iframe-resizer/core": "5.3.0-beta.1"
|
|
49
48
|
}
|
|
50
49
|
}
|