feat(info): invite url as an anchor for copying from context menu

This commit is contained in:
Leonard Kim 2018-04-08 09:21:52 -07:00 committed by Saúl Ibarra Corretgé
parent 10c8d380b7
commit c377219013
2 changed files with 26 additions and 1 deletions

View File

@ -81,6 +81,11 @@
font-size: 16px;
}
.info-dialog-invite-link {
color: inherit;
cursor: inherit;
}
.info-dialog-title {
font-weight: bold;
margin-bottom: 10px;

View File

@ -147,6 +147,7 @@ class InfoDialog extends Component {
this._copyElement = null;
// Bind event handlers so they are only bound once for every instance.
this._onClickInviteURL = this._onClickInviteURL.bind(this);
this._onCopyInviteURL = this._onCopyInviteURL.bind(this);
this._onPasswordRemove = this._onPasswordRemove.bind(this);
this._onPasswordSubmit = this._onPasswordSubmit.bind(this);
@ -219,7 +220,12 @@ class InfoDialog extends Component {
</span>
<span className = 'spacer'>&nbsp;</span>
<span className = 'info-value'>
{ this._getURLToDisplay() }
<a
className = 'info-dialog-invite-link'
href = { this.props._inviteURL }
onClick = { this._onClickInviteURL } >
{ this._getURLToDisplay() }
</a>
</span>
</div>
<div className = 'info-dialog-dial-in'>
@ -346,6 +352,20 @@ class InfoDialog extends Component {
return this.props._inviteURL.replace(/^https?:\/\//i, '');
}
/**
* Callback invoked when the displayed invite URL link is clicked to prevent
* actual navigation from happening. The invite URL link has an href to
* display "Copy Link Address" in the context menu but otherwise it should
* not behave like a link.
*
* @param {Object} event - The click event from clicking on the link.
* @private
* @returns {void}
*/
_onClickInviteURL(event) {
event.preventDefault();
}
/**
* Callback invoked to copy the contents of {@code this._copyElement} to the
* clipboard.