|
|
|
@ -227,12 +227,19 @@ export class AppComponent implements OnInit {
|
|
|
|
|
const options = [
|
|
|
|
|
{name: 'Make Virtual Root', icon: 'fa fa-search-plus', value: 'virtual_root'},
|
|
|
|
|
{name: 'Export to HTML', icon: 'fa fa-file-export', value: 'export_html'},
|
|
|
|
|
// {name: 'Export as PDF', icon: 'fa fa-file-export', value: 'export_pdf'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const manageOptions = [
|
|
|
|
|
{name: 'Share Sub-Tree', icon: 'fa fa-share-alt', value: 'share'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if ( this.menuTarget.data.bookmark ) {
|
|
|
|
|
options.push({name: 'Remove Bookmark', icon: 'fa fa-star', value: 'bookmark_remove'});
|
|
|
|
|
} else {
|
|
|
|
|
options.push({name: 'Bookmark', icon: 'fa fa-star', value: 'bookmark_add'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const popover = await this.popover.create({
|
|
|
|
|
component: OptionMenuComponent,
|
|
|
|
|
componentProps: {
|
|
|
|
@ -263,8 +270,14 @@ export class AppComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
} else if ( result.data === 'export_html' ) {
|
|
|
|
|
this.exportTargetAsHTML();
|
|
|
|
|
} else if ( result.data === 'export_pdf' ) {
|
|
|
|
|
this.exportTargetAsPDF();
|
|
|
|
|
} else if ( result.data === 'virtual_root' ) {
|
|
|
|
|
this.setVirtualRoot();
|
|
|
|
|
} else if ( result.data === 'bookmark_add' ) {
|
|
|
|
|
this.addBookmark();
|
|
|
|
|
} else if ( result.data === 'bookmark_remove' ) {
|
|
|
|
|
this.removeBookmark();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -303,6 +316,25 @@ export class AppComponent implements OnInit {
|
|
|
|
|
window.open(dlUrl, '_blank');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addBookmark() {
|
|
|
|
|
const bookmarks = this.session.get('user.preferences.bookmark_page_ids') || [];
|
|
|
|
|
|
|
|
|
|
if ( !bookmarks.includes(this.menuTarget.data.id) ) {
|
|
|
|
|
bookmarks.push(this.menuTarget.data.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.session.set('user.preferences.bookmark_page_ids', bookmarks);
|
|
|
|
|
this.session.save().then(() => this.navService.requestSidebarRefresh({ quiet: true }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeBookmark() {
|
|
|
|
|
let bookmarks = this.session.get('user.preferences.bookmark_page_ids') || [];
|
|
|
|
|
bookmarks = bookmarks.filter(x => x !== this.menuTarget.data.id);
|
|
|
|
|
|
|
|
|
|
this.session.set('user.preferences.bookmark_page_ids', bookmarks);
|
|
|
|
|
this.session.save().then(() => this.navService.requestSidebarRefresh({ quiet: true }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async onCreateClick($event: MouseEvent) {
|
|
|
|
|
const menuItems = [
|
|
|
|
|
{
|
|
|
|
|