extract links in posts in include in the share or clipboard data resolves issue #68
This commit is contained in:
parent
1e0d8a2af0
commit
ea641c52fe
1 changed files with 17 additions and 2 deletions
|
@ -39,7 +39,7 @@ export class PostMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
share() {
|
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('sharing post:');
|
||||||
console.log(JSON.stringify(e));
|
console.log(JSON.stringify(e));
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
|
@ -50,11 +50,26 @@ export class PostMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
this.clipboardSrv.copyFromContent(this.navParams.data.post.content.text);
|
this.clipboardSrv.copyFromContent(this.parsePost());
|
||||||
this.presentToast('Post copied');
|
this.presentToast('Post copied');
|
||||||
this.close();
|
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() {
|
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