Iframe.js
5 years ago
core-embeds.js
5 years ago
embed-controls.js
6 years ago
embed-loading.js
7 years ago
embed-placeholder.js
5 years ago
embed-wrap.js
5 years ago
icons.js
5 years ago
embed-wrap.js
29 lines
| 1 | /* |
| 2 | INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties |
| 3 | JSX USAGE: <Epwrap src='http://web.site' onLoad={myOnloadFunction}/> |
| 4 | */ |
| 5 | import ReactDOM from 'react-dom' |
| 6 | const { Component } = wp.element; |
| 7 | |
| 8 | export default class EmbedWrap extends Component { |
| 9 | constructor(props) { |
| 10 | super(props); |
| 11 | this.myRef = React.createRef(); |
| 12 | } |
| 13 | componentDidMount () { |
| 14 | let wrap = ReactDOM.findDOMNode(this.myRef.current) |
| 15 | wrap.addEventListener('load', this.props.onLoad); |
| 16 | } |
| 17 | |
| 18 | render () { |
| 19 | |
| 20 | return ( |
| 21 | <div |
| 22 | ref={this.myRef} |
| 23 | {...this.props} |
| 24 | ></div> |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | } |
| 29 |