react-frame-component 5.2.2-alpha.0 → 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/index.d.ts +31 -1
- package/lib/Frame.js +3 -5
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1 +1,31 @@
|
|
|
1
|
-
declare module 'react-frame-component'
|
|
1
|
+
declare module 'react-frame-component' {
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
export interface FrameComponentProps
|
|
5
|
+
extends React.IframeHTMLAttributes<HTMLIFrameElement> {
|
|
6
|
+
head?: React.ReactNode | undefined;
|
|
7
|
+
mountTarget?: string | undefined;
|
|
8
|
+
initialContent?: string | undefined;
|
|
9
|
+
contentDidMount?: (() => void) | undefined;
|
|
10
|
+
contentDidUpdate?: (() => void) | undefined;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
ref?: React.Ref<HTMLIFrameElement>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class FrameComponent extends React.Component<
|
|
16
|
+
FrameComponentProps
|
|
17
|
+
> {}
|
|
18
|
+
|
|
19
|
+
export interface FrameContextProps {
|
|
20
|
+
document?: HTMLDocument;
|
|
21
|
+
window?: Window;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const FrameContext: React.Context<FrameContextProps>;
|
|
25
|
+
|
|
26
|
+
export const FrameContextProvider: React.Provider<FrameContextProps>;
|
|
27
|
+
|
|
28
|
+
export const FrameContextConsumer: React.Consumer<FrameContextProps>;
|
|
29
|
+
|
|
30
|
+
export function useFrame(): FrameContextProps;
|
|
31
|
+
}
|
package/lib/Frame.js
CHANGED
|
@@ -77,10 +77,8 @@ var Frame = exports.Frame = function (_Component) {
|
|
|
77
77
|
var doc = this.getDoc();
|
|
78
78
|
if (doc && doc.readyState === 'complete') {
|
|
79
79
|
this.forceUpdate();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (doc) {
|
|
83
|
-
this.nodeRef.current.contentWindow.addEventListener('DOMContentLoaded', this.handleLoad);
|
|
80
|
+
} else {
|
|
81
|
+
this.nodeRef.current.addEventListener('load', this.handleLoad);
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
}, {
|
|
@@ -157,7 +155,7 @@ var Frame = exports.Frame = function (_Component) {
|
|
|
157
155
|
delete props.forwardedRef;
|
|
158
156
|
return _react2.default.createElement(
|
|
159
157
|
'iframe',
|
|
160
|
-
_extends({}, props, { ref: this.setRef }),
|
|
158
|
+
_extends({}, props, { ref: this.setRef, onLoad: this.handleLoad }),
|
|
161
159
|
this.state.iframeLoaded && this.renderFrameContents()
|
|
162
160
|
);
|
|
163
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-frame-component",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3",
|
|
4
4
|
"description": "React component to wrap your application or component in an iFrame for encapsulation purposes",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"gh-pages": "^1.1.0",
|
|
63
63
|
"html-webpack-plugin": "^2.28.0",
|
|
64
64
|
"husky": "^0.14.3",
|
|
65
|
-
"karma": "^
|
|
65
|
+
"karma": "^6.3.16",
|
|
66
66
|
"karma-chrome-launcher": "^2.0.0",
|
|
67
67
|
"karma-mocha": "^1.3.0",
|
|
68
68
|
"karma-osx-reporter": "^0.2.1",
|