import React from 'react';
class Embed extends React.Component {
	constructor(props) {
		super(props);
	}

	componentDidUpdate() {
	    document.querySelectorAll( 'oembed[url]' ).forEach( element => {
	    	element.innerHTML = "";
	        window.iframely.load( element, element.attributes.url.value );
	    } );
	}

	render() {
		let {
			html,
			...rest
		} = this.props;
		return <div dangerouslySetInnerHTML={{__html: html}} {...rest}>
		</div>;
	}
}

export default Embed;