|
|
|
@ -59,19 +59,14 @@ export class SearchComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openResult(result: SearchResult) {
|
|
|
|
|
const nodeTypes = [
|
|
|
|
|
'node', 'code', 'db', 'files', 'markdown',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if ( result.type === 'page' ) {
|
|
|
|
|
await this.router.navigate(['/editor', { id: result.id }]);
|
|
|
|
|
await this.dismiss();
|
|
|
|
|
} else if ( result.type === 'node' ) {
|
|
|
|
|
await this.router.navigate(['/editor', { id: result.associated.id, node_id: result.id }]);
|
|
|
|
|
await this.dismiss();
|
|
|
|
|
} else if ( result.type === 'code' ) {
|
|
|
|
|
await this.router.navigate(['/editor', { id: result.associated.id, node_id: result.id }]);
|
|
|
|
|
await this.dismiss();
|
|
|
|
|
} else if ( result.type === 'db' ) {
|
|
|
|
|
await this.router.navigate(['/editor', { id: result.associated.id, node_id: result.id }]);
|
|
|
|
|
await this.dismiss();
|
|
|
|
|
} else if ( result.type === 'files' ) {
|
|
|
|
|
} else if ( nodeTypes.includes(result.type) ) {
|
|
|
|
|
await this.router.navigate(['/editor', { id: result.associated.id, node_id: result.id }]);
|
|
|
|
|
await this.dismiss();
|
|
|
|
|
}
|
|
|
|
|