import React from 'react'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import validUrl from 'valid-url'; import { translate } from "react-i18next"; class AddImageDialog extends React.Component { state = { url: '', error: null }; handleUrlChange = (event) => { this.setState({url: event.target.value}); } handleSubmit = (event) => { if (validUrl.isUri(this.state.url)) { this.props.toggleImageDialog(); this.props.onInsertImage(this.state.url); } else { this.setState({error: this.props.t('invalid_url')}); } } render() { return ( {this.props.t("insert_image")}

{this.props.t("enter_the_url_of_the_image")}:

{this.state.error &&

{this.state.error}

}
{' '}
) } } export default translate("translations")(AddImageDialog);