|
|
|
@ -148,7 +148,6 @@ export class AppComponent implements OnInit {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('firing search');
|
|
|
|
|
const modal = await this.modal.create({
|
|
|
|
|
component: SearchComponent,
|
|
|
|
|
});
|
|
|
|
@ -167,11 +166,24 @@ export class AppComponent implements OnInit {
|
|
|
|
|
canManage = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !this.menuTarget.data.id ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
|
{name: 'Export to HTML', icon: 'fa fa-file-export', value: 'export_html'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const manageOptions = [
|
|
|
|
|
{name: 'Share Sub-Tree', icon: 'fa fa-share-alt', value: 'share'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const popover = await this.popover.create({
|
|
|
|
|
component: OptionMenuComponent,
|
|
|
|
|
componentProps: {
|
|
|
|
|
menuItems: [
|
|
|
|
|
...(!canManage ? [] : [{name: 'Share Sub-Tree', icon: 'person-add', value: 'share'}]),
|
|
|
|
|
...(!canManage ? options : [...options, ...manageOptions]),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
event: $event,
|
|
|
|
@ -187,12 +199,33 @@ export class AppComponent implements OnInit {
|
|
|
|
|
}).then(modal => {
|
|
|
|
|
modal.present();
|
|
|
|
|
});
|
|
|
|
|
} else if ( result.data === 'export_html' ) {
|
|
|
|
|
this.exportTargetAsHTML();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await popover.present();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async exportTargetAsHTML() {
|
|
|
|
|
const exportRecord: any = await new Promise((res, rej) => {
|
|
|
|
|
const reqData = {
|
|
|
|
|
format: 'html',
|
|
|
|
|
PageId: this.menuTarget.data.id,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.api.post(`/exports/subtree`, reqData).subscribe({
|
|
|
|
|
next: (result) => {
|
|
|
|
|
res(result.data);
|
|
|
|
|
},
|
|
|
|
|
error: rej
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const dlUrl = this.api._build_url(`/exports/${exportRecord.UUID}/download`);
|
|
|
|
|
window.open(dlUrl, '_blank');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async onTopLevelCreate() {
|
|
|
|
|
const alert = await this.alerts.create({
|
|
|
|
|
header: 'Create Page',
|
|
|
|
|