From eb158ed5b3b380947645b8c9870d13ed35953ab0 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Wed, 21 Nov 2018 15:46:22 -0800 Subject: [PATCH] added copy post link to clipboard as a way to work around #82 while browser bugs are fixed --- src/pages/stream/post-menu.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/stream/post-menu.ts b/src/pages/stream/post-menu.ts index 092b459..34d6a2b 100644 --- a/src/pages/stream/post-menu.ts +++ b/src/pages/stream/post-menu.ts @@ -12,6 +12,7 @@ import * as pnut from 'pnut-butter'; + ` @@ -20,9 +21,11 @@ export class PostMenu { showDelBtn: boolean = false; showShareBtn: boolean = false; + postURL: string; constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController, public events: Events, private clipboardSrv: ClipboardService, private device: Device) { + this.postURL = 'https://posts.pnut.io/' + this.navParams.data.post.id; if (navParams.data.me == navParams.data.post.user.username) { this.showDelBtn = true; } else { @@ -34,7 +37,7 @@ export class PostMenu { } browse() { - window.open('https://posts.pnut.io/' + this.navParams.data.post.id, '_system'); + window.open(this.postURL, '_system'); this.close(); } @@ -70,6 +73,12 @@ export class PostMenu { return text; } + copyPostURL() { + this.clipboardSrv.copyFromContent(this.postURL); + this.presentToast('Post link copied'); + this.close(); + } + delete() { pnut.deletePost(this.navParams.data.post.id).then(res => { console.log(res);