- ); - } } PreviewFrame.propTypes = { - isPlaying: PropTypes.bool.isRequired, - isAccessibleOutputPlaying: PropTypes.bool.isRequired, - textOutput: PropTypes.bool.isRequired, - gridOutput: PropTypes.bool.isRequired, - soundOutput: PropTypes.bool.isRequired, - htmlFile: PropTypes.shape({ - content: PropTypes.string.isRequired - }).isRequired, - files: PropTypes.arrayOf( - PropTypes.shape({ - content: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - url: PropTypes.string, - id: PropTypes.string.isRequired - }) - ).isRequired, - endSketchRefresh: PropTypes.func.isRequired, - previewIsRefreshing: PropTypes.bool.isRequired, - fullView: PropTypes.bool, - setBlobUrl: PropTypes.func.isRequired, - clearConsole: PropTypes.func.isRequired, - cmController: PropTypes.shape({ - getContent: PropTypes.func - }) + fullView: PropTypes.bool }; PreviewFrame.defaultProps = { - fullView: false, - cmController: {} -}; - -function mapStateToProps(state, ownProps) { - if (ownProps.fullView) { - return { - files: state.files, - htmlFile: getHTMLFile(state.files), - isPlaying: true, - isAccessibleOutputPlaying: false, - textOutput: false, - gridOutput: false, - soundOutput: false, - language: state.preferences.language, - autorefresh: false, - previewIsRefreshing: false - }; - } - return { - files: state.files, - htmlFile: getHTMLFile(state.files), - content: ( - state.files.find((file) => file.isSelectedFile) || - state.files.find((file) => file.name === 'sketch.js') || - state.files.find((file) => file.name !== 'root') - ).content, - isPlaying: state.ide.isPlaying, - isAccessibleOutputPlaying: state.ide.isAccessibleOutputPlaying, - previewIsRefreshing: state.ide.previewIsRefreshing, - textOutput: state.preferences.textOutput, - gridOutput: state.preferences.gridOutput, - soundOutput: state.preferences.soundOutput, - language: state.preferences.language, - autorefresh: state.preferences.autorefresh - }; -} - -const mapDispatchToProps = { - stopSketch, - expandConsole, - endSketchRefresh, - setTextOutput, - setGridOutput, - setSoundOutput, - setBlobUrl, - clearConsole, - dispatchConsoleEvent + fullView: false }; -export default connect(mapStateToProps, mapDispatchToProps)(PreviewFrame); +export default PreviewFrame; diff --git a/client/modules/IDE/components/ShareModal.jsx b/client/modules/IDE/components/ShareModal.jsx index ea947e88ad..6f029437b0 100644 --- a/client/modules/IDE/components/ShareModal.jsx +++ b/client/modules/IDE/components/ShareModal.jsx @@ -2,22 +2,24 @@ import PropTypes from 'prop-types'; import React from 'react'; import { withTranslation } from 'react-i18next'; import CopyableInput from './CopyableInput'; +import getConfig from '../../../utils/getConfig'; class ShareModal extends React.PureComponent { render() { const { projectId, ownerUsername, projectName } = this.props; const hostname = window.location.origin; + const previewUrl = getConfig('PREVIEW_URL'); return ( <div className="share-modal"> <h3 className="share-modal__project-name">{projectName}</h3> <CopyableInput label={this.props.t('ShareModal.Embed')} - value={`<iframe src="${hostname}/${ownerUsername}/embed/${projectId}">