diff --git a/client/components/Nav/NavBar.jsx b/client/components/Nav/NavBar.jsx index 897b2ac854..16d92b8689 100644 --- a/client/components/Nav/NavBar.jsx +++ b/client/components/Nav/NavBar.jsx @@ -71,7 +71,10 @@ function NavBar({ children, className }) { onFocus: clearHideTimeout }), createMenuItemHandlers: (dropdown) => ({ - onMouseUp: () => { + onMouseUp: (e) => { + if (e.button === 2) { + return; + } setDropdownOpen('none'); }, onBlur: handleBlur, diff --git a/client/modules/IDE/actions/assets.js b/client/modules/IDE/actions/assets.js index 8c7a046121..0a7a13e3a0 100644 --- a/client/modules/IDE/actions/assets.js +++ b/client/modules/IDE/actions/assets.js @@ -11,20 +11,18 @@ function setAssets(assets, totalSize) { } export function getAssets() { - return (dispatch) => { + return async (dispatch) => { dispatch(startLoader()); - apiClient - .get('/S3/objects') - .then((response) => { - dispatch(setAssets(response.data.assets, response.data.totalSize)); - dispatch(stopLoader()); - }) - .catch(() => { - dispatch({ - type: ActionTypes.ERROR - }); - dispatch(stopLoader()); + try { + const response = await apiClient.get('/S3/objects'); + dispatch(setAssets(response.data.assets, response.data.totalSize)); + dispatch(stopLoader()); + } catch (error) { + dispatch({ + type: ActionTypes.ERROR }); + dispatch(stopLoader()); + } }; } @@ -36,16 +34,14 @@ export function deleteAsset(assetKey) { } export function deleteAssetRequest(assetKey) { - return (dispatch) => { - apiClient - .delete(`/S3/${assetKey}`) - .then((response) => { - dispatch(deleteAsset(assetKey)); - }) - .catch(() => { - dispatch({ - type: ActionTypes.ERROR - }); + return async (dispatch) => { + try { + await apiClient.delete(`/S3/${assetKey}`); + dispatch(deleteAsset(assetKey)); + } catch (error) { + dispatch({ + type: ActionTypes.ERROR }); + } }; } diff --git a/client/modules/Preview/EmbedFrame.jsx b/client/modules/Preview/EmbedFrame.jsx index 43f229fa2d..e445fc152d 100644 --- a/client/modules/Preview/EmbedFrame.jsx +++ b/client/modules/Preview/EmbedFrame.jsx @@ -252,7 +252,7 @@ function injectLocalFiles(files, htmlFile, options) { 'PREVIEW_SCRIPTS_URL' )}`; previewScripts.setAttribute('crossorigin', ''); - sketchDoc.head.appendChild(previewScripts); + sketchDoc.body.appendChild(previewScripts); const sketchDocString = `\n${sketchDoc.documentElement.outerHTML}`; scriptOffs = getAllScriptOffsets(sketchDocString); diff --git a/client/modules/User/pages/EmailVerificationView.jsx b/client/modules/User/pages/EmailVerificationView.jsx index 42960062b4..5f7bbd92bb 100644 --- a/client/modules/User/pages/EmailVerificationView.jsx +++ b/client/modules/User/pages/EmailVerificationView.jsx @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { useEffect } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { withTranslation } from 'react-i18next'; @@ -9,57 +9,51 @@ import { verifyEmailConfirmation } from '../actions'; import RootPage from '../../../components/RootPage'; import Nav from '../../IDE/components/Header/Nav'; -class EmailVerificationView extends React.Component { - static defaultProps = { - emailVerificationTokenState: null - }; - - componentWillMount() { - const verificationToken = this.verificationToken(); - if (verificationToken != null) { - this.props.verifyEmailConfirmation(verificationToken); - } - } +const EmailVerificationView = (props) => { + const { emailVerificationTokenState, location, t } = props; - verificationToken = () => { - const { location } = this.props; + const verificationTokenFromLocation = () => { const searchParams = new URLSearchParams(location.search); return searchParams.get('t'); }; - render() { - let status = null; - const { emailVerificationTokenState } = this.props; - - if (this.verificationToken() == null) { - status =

{this.props.t('EmailVerificationView.InvalidTokenNull')}

; - } else if (emailVerificationTokenState === 'checking') { - status =

{this.props.t('EmailVerificationView.Checking')}

; - } else if (emailVerificationTokenState === 'verified') { - status =

{this.props.t('EmailVerificationView.Verified')}

; - setTimeout(() => browserHistory.push('/'), 1000); - } else if (emailVerificationTokenState === 'invalid') { - status =

{this.props.t('EmailVerificationView.InvalidState')}

; + useEffect(() => { + const verificationToken = verificationTokenFromLocation(); + if (verificationToken != null) { + props.verifyEmailConfirmation(verificationToken); } + }, [location, props]); - return ( - -