|
|
@ -40,9 +40,11 @@ export class AppComponent implements OnInit {
|
|
|
|
public lastClickEvent: Array<any> = [];
|
|
|
|
public lastClickEvent: Array<any> = [];
|
|
|
|
public nodes = [];
|
|
|
|
public nodes = [];
|
|
|
|
public currentPageId: string;
|
|
|
|
public currentPageId: string;
|
|
|
|
|
|
|
|
public virtualRootPageId?: string;
|
|
|
|
public options = {
|
|
|
|
public options = {
|
|
|
|
isExpandedField: 'expanded',
|
|
|
|
isExpandedField: 'expanded',
|
|
|
|
animateExpand: true,
|
|
|
|
animateExpand: true,
|
|
|
|
|
|
|
|
scrollOnActivate: false,
|
|
|
|
actionMapping: {
|
|
|
|
actionMapping: {
|
|
|
|
mouse: {
|
|
|
|
mouse: {
|
|
|
|
dblClick: (tree, node, $event) => {
|
|
|
|
dblClick: (tree, node, $event) => {
|
|
|
@ -208,6 +210,7 @@ export class AppComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
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 to HTML', icon: 'fa fa-file-export', value: 'export_html'},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
@ -245,12 +248,27 @@ export class AppComponent implements OnInit {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if ( result.data === 'export_html' ) {
|
|
|
|
} else if ( result.data === 'export_html' ) {
|
|
|
|
this.exportTargetAsHTML();
|
|
|
|
this.exportTargetAsHTML();
|
|
|
|
|
|
|
|
} else if ( result.data === 'virtual_root' ) {
|
|
|
|
|
|
|
|
this.setVirtualRoot();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
await popover.present();
|
|
|
|
await popover.present();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async setVirtualRoot() {
|
|
|
|
|
|
|
|
if ( this.menuTarget && this.menuTarget.data?.type === 'page' ) {
|
|
|
|
|
|
|
|
debug('virtual root menu target', this.menuTarget);
|
|
|
|
|
|
|
|
this.virtualRootPageId = this.menuTarget.data.id;
|
|
|
|
|
|
|
|
this.reloadMenuItems().subscribe();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onVirtualRootClear(event) {
|
|
|
|
|
|
|
|
delete this.virtualRootPageId;
|
|
|
|
|
|
|
|
this.reloadMenuItems().subscribe();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async exportTargetAsHTML() {
|
|
|
|
async exportTargetAsHTML() {
|
|
|
|
const exportRecord: any = await new Promise((res, rej) => {
|
|
|
|
const exportRecord: any = await new Promise((res, rej) => {
|
|
|
|
const reqData = {
|
|
|
|
const reqData = {
|
|
|
@ -440,7 +458,7 @@ export class AppComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
reloadMenuItems() {
|
|
|
|
reloadMenuItems() {
|
|
|
|
return new Observable(sub => {
|
|
|
|
return new Observable(sub => {
|
|
|
|
this.api.getMenuItems().then(nodes => {
|
|
|
|
this.api.getMenuItems(false, this.virtualRootPageId).then(nodes => {
|
|
|
|
this.nodes = nodes;
|
|
|
|
this.nodes = nodes;
|
|
|
|
sub.next();
|
|
|
|
sub.next();
|
|
|
|
sub.complete();
|
|
|
|
sub.complete();
|
|
|
|