extract links in posts in include in the share or clipboard data resolves issue #68

This commit is contained in:
Morgan McMillian 2018-11-21 09:50:40 -08:00
parent 1e0d8a2af0
commit ea641c52fe

View file

@ -39,7 +39,7 @@ export class PostMenu {
}
share() {
(<any>window).shareContentPlugin.share(this.navParams.data.post.content.text, function(e) {
(<any>window).shareContentPlugin.share(this.parsePost(), function(e) {
console.log('sharing post:');
console.log(JSON.stringify(e));
}, function(e) {
@ -50,11 +50,26 @@ export class PostMenu {
}
copy() {
this.clipboardSrv.copyFromContent(this.navParams.data.post.content.text);
this.clipboardSrv.copyFromContent(this.parsePost());
this.presentToast('Post copied');
this.close();
}
parsePost() {
let text = this.navParams.data.post.content.text;
let links = this.navParams.data.post.content.entities.links;
if (links.length > 0) {
for (var i = 0; i < links.length; i++) {
text += "\n";
if (typeof links[i].title !== "undefined") {
text += links[i].title + " - ";
}
text += links[i].link;
}
}
return text;
}
delete() {
pnut.deletePost(this.navParams.data.post.id).then(res => {
console.log(res);