added copy post link to clipboard as a way to work around #82 while browser bugs are fixed
This commit is contained in:
parent
fc1849e384
commit
eb158ed5b3
1 changed files with 10 additions and 1 deletions
|
@ -12,6 +12,7 @@ import * as pnut from 'pnut-butter';
|
||||||
<button ion-item (click)="browse()">Open in Browser</button>
|
<button ion-item (click)="browse()">Open in Browser</button>
|
||||||
<button ion-item *ngIf="showShareBtn" (click)="share()">Share</button>
|
<button ion-item *ngIf="showShareBtn" (click)="share()">Share</button>
|
||||||
<button ion-item (click)="copy()">Copy to clipboard</button>
|
<button ion-item (click)="copy()">Copy to clipboard</button>
|
||||||
|
<button ion-item (click)="copyPostURL()">Copy link to post</button>
|
||||||
<button ion-item *ngIf="showDelBtn" (click)="delete()">Delete</button>
|
<button ion-item *ngIf="showDelBtn" (click)="delete()">Delete</button>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
`
|
`
|
||||||
|
@ -20,9 +21,11 @@ export class PostMenu {
|
||||||
|
|
||||||
showDelBtn: boolean = false;
|
showDelBtn: boolean = false;
|
||||||
showShareBtn: boolean = false;
|
showShareBtn: boolean = false;
|
||||||
|
postURL: string;
|
||||||
|
|
||||||
constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController,
|
constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController,
|
||||||
public events: Events, private clipboardSrv: ClipboardService, private device: Device) {
|
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) {
|
if (navParams.data.me == navParams.data.post.user.username) {
|
||||||
this.showDelBtn = true;
|
this.showDelBtn = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +37,7 @@ export class PostMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
browse() {
|
browse() {
|
||||||
window.open('https://posts.pnut.io/' + this.navParams.data.post.id, '_system');
|
window.open(this.postURL, '_system');
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +73,12 @@ export class PostMenu {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyPostURL() {
|
||||||
|
this.clipboardSrv.copyFromContent(this.postURL);
|
||||||
|
this.presentToast('Post link copied');
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
pnut.deletePost(this.navParams.data.post.id).then(res => {
|
pnut.deletePost(this.navParams.data.post.id).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
Reference in a new issue