diff --git a/embark-ui/src/containers/ApplicationPreviewContainer.js b/embark-ui/src/containers/ApplicationPreviewContainer.js index 443e4181..1b880ae5 100644 --- a/embark-ui/src/containers/ApplicationPreviewContainer.js +++ b/embark-ui/src/containers/ApplicationPreviewContainer.js @@ -1,11 +1,11 @@ -import PropTypes from 'prop-types'; import React from 'react'; class ApplicationPreviewContainer extends React.Component { constructor(props) { super(props); + this.state = { - previewUrl: props.previewUrl || 'http://localhost:8000' + previewUrl: 'http://localhost:8000' }; } @@ -13,7 +13,7 @@ class ApplicationPreviewContainer extends React.Component { return (
- this.locationInput = input} value={this.props.previewUrl} /> + this.handlePreviewUrlChange(e)} />
@@ -23,6 +23,10 @@ class ApplicationPreviewContainer extends React.Component { ); } + handlePreviewUrlChange(ev) { + this.setState({previewUrl: ev.target.value}); + } + handlePreviewChange(ev) { try { let url = ev.target.contentWindow.location.toString(); @@ -33,13 +37,9 @@ class ApplicationPreviewContainer extends React.Component { } handlePreviewGo() { - this.previewIframe.src = this.locationInput.value; + this.previewIframe.src = this.previewUrl; } } -ApplicationPreviewContainer.propTypes = { - previewUrl: PropTypes.string -}; - export default ApplicationPreviewContainer;