// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import $ from 'jquery'; import ReactDOM from 'react-dom'; import {FormattedMessage} from 'react-intl'; import {Modal} from 'react-bootstrap'; import React from 'react'; export default class GetLinkModal extends React.Component { constructor(props) { super(props); this.onHide = this.onHide.bind(this); this.copyLink = this.copyLink.bind(this); this.state = { copiedLink: false }; } onHide() { this.setState({copiedLink: false}); this.props.onHide(); } copyLink() { var copyTextarea = $(ReactDOM.findDOMNode(this.refs.textarea)); copyTextarea.select(); try { var successful = document.execCommand('copy'); if (successful) { this.setState({copiedLink: true}); } else { this.setState({copiedLink: false}); } } catch (err) { this.setState({copiedLink: false}); } } render() { let helpText = null; if (this.props.helpText) { helpText = (
{this.props.helpText}