From 5dd3ba9362a8deee59862d93727b745e62c1f970 Mon Sep 17 00:00:00 2001 From: Kevin Lee <klee@mozilla.com> Date: Mon, 18 Jun 2018 18:34:02 -0700 Subject: [PATCH] use the same url as in the form when copying --- src/react-components/info-dialog.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/react-components/info-dialog.js b/src/react-components/info-dialog.js index 5f0f6bd93..e6aca2306 100644 --- a/src/react-components/info-dialog.js +++ b/src/react-components/info-dialog.js @@ -63,8 +63,8 @@ class InfoDialog extends Component { }); }; - copyLinkClicked = () => { - copy(this.shareLink); + copyLinkClicked = link => { + copy(link); this.setState({ copyLinkButtonText: "Copied!" }); }; @@ -148,7 +148,10 @@ class InfoDialog extends Component { <span>Share</span> </button> )} - <button className="invite-form__action-button" onClick={this.copyLinkClicked}> + <button + className="invite-form__action-button" + onClick={this.copyLinkClicked.bind(this, this.shareLink)} + > <span>{this.state.copyLinkButtonText}</span> </button> </div> @@ -172,12 +175,10 @@ class InfoDialog extends Component { className="invite-form__link_field" /> <div className="invite-form__buttons"> - {navigator.share && ( - <button className="invite-form__action-button" onClick={this.shareLinkClicked}> - <span>Share</span> - </button> - )} - <button className="invite-form__action-button" onClick={this.copyLinkClicked}> + <button + className="invite-form__action-button" + onClick={this.copyLinkClicked.bind(this, document.location)} + > <span>{this.state.copyLinkButtonText}</span> </button> </div> -- GitLab