// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import {FormattedMessage} from 'mm-intl'; const Modal = ReactBootstrap.Modal; 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() { const userCreationEnabled = global.window.mm_config.EnableUserCreation === 'true'; let helpText = null; if (this.props.helpText) { helpText = (

{this.props.helpText}

); } let copyLink = null; if (userCreationEnabled && document.queryCommandSupported('copy')) { copyLink = ( ); } let linkText = null; if (userCreationEnabled) { linkText = (