// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import {FormattedMessage} from 'react-intl'; import {Modal} from 'react-bootstrap'; 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() { const textarea = this.refs.textarea; textarea.focus(); textarea.setSelectionRange(0, this.props.link.length); try { if (document.execCommand('copy')) { 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}