@iframe-resizer/react 5.2.2-beta.4 → 5.2.3
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/LICENSE +1 -1
- package/README.md +1 -1
- package/index.cjs.js +49 -63
- package/index.esm.js +49 -63
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -2,7 +2,7 @@ Iframe Resizer Version 5
|
|
|
2
2
|
|
|
3
3
|
This JavaScript library is Copyright © 2013-2024 David J. Bradshaw and is distributed under the GPL V3 for non-commercial use. A commercial license is available upon request.
|
|
4
4
|
|
|
5
|
-
For more information on commercial licensing
|
|
5
|
+
For more information on commercial licensing see https://iframe-resizer.com/pricing/
|
|
6
6
|
|
|
7
7
|
--
|
|
8
8
|
|
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.2.
|
|
4
|
+
* @module iframe-resizer/react 5.2.3 (cjs) - 2024-08-05
|
|
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,84 +20,70 @@
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
22
|
const _extends = require('@babel/runtime/helpers/extends');
|
|
23
|
-
const _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
24
|
-
const _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
25
23
|
const connectResizer = require('@iframe-resizer/core');
|
|
26
24
|
const React = require('react');
|
|
27
25
|
const warning = require('warning');
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
const filterIframeAttribs = (props => {
|
|
28
|
+
const {
|
|
29
|
+
license,
|
|
30
|
+
bodyBackground,
|
|
31
|
+
bodyMargin,
|
|
32
|
+
bodyPadding,
|
|
33
|
+
checkOrigin,
|
|
34
|
+
direction,
|
|
35
|
+
inPageLinks,
|
|
36
|
+
log,
|
|
37
|
+
offset,
|
|
38
|
+
offsetHeight,
|
|
39
|
+
offsetWidth,
|
|
40
|
+
scrolling,
|
|
41
|
+
tolerance,
|
|
42
|
+
warningTimeout,
|
|
43
|
+
waitForLoad,
|
|
44
|
+
onClosed,
|
|
45
|
+
onReady,
|
|
46
|
+
onMessage,
|
|
47
|
+
onResized,
|
|
48
|
+
...iframeProps
|
|
49
|
+
} = props;
|
|
51
50
|
return iframeProps;
|
|
52
51
|
});
|
|
53
52
|
|
|
54
|
-
var _excluded = ["title", "forwardRef"];
|
|
55
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
56
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
57
53
|
function IframeResizer(props) {
|
|
58
54
|
// eslint-disable-next-line react/prop-types
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
const {
|
|
56
|
+
title,
|
|
57
|
+
forwardRef,
|
|
58
|
+
...rest
|
|
59
|
+
} = props;
|
|
60
|
+
const filteredProps = filterIframeAttribs(rest);
|
|
61
|
+
const iframeRef = React.useRef(null);
|
|
62
|
+
const onClose = () => {
|
|
63
|
+
warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
|
|
67
64
|
return !iframeRef.current; // Allow React to close this
|
|
68
65
|
};
|
|
69
66
|
|
|
70
67
|
// This hook is only run once, as once iframe-resizer is bound, it will
|
|
71
68
|
// deal with changes to the element and does not need recalling
|
|
72
|
-
React.useEffect(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
const iframe = iframeRef.current;
|
|
71
|
+
const resizer = connectResizer({
|
|
72
|
+
...rest,
|
|
73
|
+
onClose
|
|
74
|
+
})(iframe);
|
|
75
|
+
return () => resizer?.disconnect();
|
|
80
76
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
81
77
|
|
|
82
|
-
React.useImperativeHandle(forwardRef,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return iframeRef.current.iframeResizer.resize();
|
|
92
|
-
},
|
|
93
|
-
moveToAnchor: function moveToAnchor(anchor) {
|
|
94
|
-
return iframeRef.current.iframeResizer.moveToAnchor(anchor);
|
|
95
|
-
},
|
|
96
|
-
sendMessage: function sendMessage(message, targetOrigin) {
|
|
97
|
-
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
});
|
|
78
|
+
React.useImperativeHandle(forwardRef, () => ({
|
|
79
|
+
getRef: () => iframeRef,
|
|
80
|
+
getElement: () => iframeRef.current,
|
|
81
|
+
resize: () => iframeRef.current.iframeResizer.resize(),
|
|
82
|
+
moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
|
|
83
|
+
sendMessage: (message, targetOrigin) => {
|
|
84
|
+
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
101
87
|
return /*#__PURE__*/React.createElement("iframe", _extends({
|
|
102
88
|
title: title
|
|
103
89
|
}, filteredProps, {
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/react 5.2.
|
|
4
|
+
* @module iframe-resizer/react 5.2.3 (esm) - 2024-08-05
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -18,84 +18,70 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
import _extends from '@babel/runtime/helpers/extends';
|
|
21
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
22
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
23
21
|
import connectResizer from '@iframe-resizer/core';
|
|
24
22
|
import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
25
23
|
import warning from 'warning';
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
25
|
+
const filterIframeAttribs = (props => {
|
|
26
|
+
const {
|
|
27
|
+
license,
|
|
28
|
+
bodyBackground,
|
|
29
|
+
bodyMargin,
|
|
30
|
+
bodyPadding,
|
|
31
|
+
checkOrigin,
|
|
32
|
+
direction,
|
|
33
|
+
inPageLinks,
|
|
34
|
+
log,
|
|
35
|
+
offset,
|
|
36
|
+
offsetHeight,
|
|
37
|
+
offsetWidth,
|
|
38
|
+
scrolling,
|
|
39
|
+
tolerance,
|
|
40
|
+
warningTimeout,
|
|
41
|
+
waitForLoad,
|
|
42
|
+
onClosed,
|
|
43
|
+
onReady,
|
|
44
|
+
onMessage,
|
|
45
|
+
onResized,
|
|
46
|
+
...iframeProps
|
|
47
|
+
} = props;
|
|
49
48
|
return iframeProps;
|
|
50
49
|
});
|
|
51
50
|
|
|
52
|
-
var _excluded = ["title", "forwardRef"];
|
|
53
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
54
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
55
51
|
function IframeResizer(props) {
|
|
56
52
|
// eslint-disable-next-line react/prop-types
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
const {
|
|
54
|
+
title,
|
|
55
|
+
forwardRef,
|
|
56
|
+
...rest
|
|
57
|
+
} = props;
|
|
58
|
+
const filteredProps = filterIframeAttribs(rest);
|
|
59
|
+
const iframeRef = useRef(null);
|
|
60
|
+
const onClose = () => {
|
|
61
|
+
warning(!iframeRef.current, `[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`);
|
|
65
62
|
return !iframeRef.current; // Allow React to close this
|
|
66
63
|
};
|
|
67
64
|
|
|
68
65
|
// This hook is only run once, as once iframe-resizer is bound, it will
|
|
69
66
|
// deal with changes to the element and does not need recalling
|
|
70
|
-
useEffect(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const iframe = iframeRef.current;
|
|
69
|
+
const resizer = connectResizer({
|
|
70
|
+
...rest,
|
|
71
|
+
onClose
|
|
72
|
+
})(iframe);
|
|
73
|
+
return () => resizer?.disconnect();
|
|
78
74
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
79
75
|
|
|
80
|
-
useImperativeHandle(forwardRef,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return iframeRef.current.iframeResizer.resize();
|
|
90
|
-
},
|
|
91
|
-
moveToAnchor: function moveToAnchor(anchor) {
|
|
92
|
-
return iframeRef.current.iframeResizer.moveToAnchor(anchor);
|
|
93
|
-
},
|
|
94
|
-
sendMessage: function sendMessage(message, targetOrigin) {
|
|
95
|
-
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
});
|
|
76
|
+
useImperativeHandle(forwardRef, () => ({
|
|
77
|
+
getRef: () => iframeRef,
|
|
78
|
+
getElement: () => iframeRef.current,
|
|
79
|
+
resize: () => iframeRef.current.iframeResizer.resize(),
|
|
80
|
+
moveToAnchor: anchor => iframeRef.current.iframeResizer.moveToAnchor(anchor),
|
|
81
|
+
sendMessage: (message, targetOrigin) => {
|
|
82
|
+
iframeRef.current.iframeResizer.sendMessage(message, targetOrigin);
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
99
85
|
return /*#__PURE__*/React.createElement("iframe", _extends({
|
|
100
86
|
title: title
|
|
101
87
|
}, filteredProps, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iframe-resizer/react",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"homepage": "https://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"module": "index.esm.js",
|
|
22
22
|
"types": "iframe-resizer.react.d.ts",
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
25
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
24
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
25
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"iframe",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.25.0",
|
|
47
|
-
"@iframe-resizer/core": "5.2.
|
|
47
|
+
"@iframe-resizer/core": "5.2.3",
|
|
48
48
|
"warning": "^4.0.3"
|
|
49
49
|
}
|
|
50
50
|
}
|