Skip to content

Commit

Permalink
GH-5706: DIsposed the clipboard copy listener.
Browse files Browse the repository at this point in the history
Closes #5706.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
  • Loading branch information
Akos Kitta committed Jul 15, 2019
1 parent 60dcb33 commit 3929e50
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export class FileDownloadService {
const downloadUrl = `${this.endpoint()}/download/?id=${jsonResponse.id}`;
if (copyLink) {
if (document.documentElement) {
addClipboardListener(document.documentElement, 'copy', e => this.handleCopy(e, downloadUrl));
const toDispose = addClipboardListener(document.documentElement, 'copy', e => {
toDispose.dispose();
this.handleCopy(e, downloadUrl);
});
document.execCommand('copy');
}
} else {
Expand Down

0 comments on commit 3929e50

Please sign in to comment.