Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, signal, inject, computed } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, signal, inject, computed } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
Expand Down Expand Up @@ -32,7 +32,7 @@ interface ChatMessage {
RouterModule,
],
})
export class EditDatabaseSchemaComponent implements OnInit, AfterViewInit {
export class EditDatabaseSchemaComponent implements OnInit {
@Input() connectionID: string;
@Input() showClose: boolean = false;
@Output() schemaApplied = new EventEmitter<void>();
Expand Down Expand Up @@ -60,18 +60,6 @@ export class EditDatabaseSchemaComponent implements OnInit, AfterViewInit {
return null;
});

async ngAfterViewInit() {
const mermaid = await import('mermaid');
const mermaidAPI = (mermaid.default ?? mermaid) as { initialize: (config: Record<string, unknown>) => void };
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
mermaidAPI.initialize({
startOnLoad: false,
theme: isDark ? 'dark' : 'default',
});
//@ts-expect-error dynamic load of mermaid
window.mermaid = mermaidAPI;
}

ngOnInit(): void {
if (!this.connectionID) {
const id = this._route.snapshot.paramMap.get('connection-id');
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,14 @@ bootstrapApplication(AppComponent, {
NotificationsService,
TablesService,
CookieService,
provideMarkdown(),
provideMarkdown({
mermaidOptions: {
useValue: {
startOnLoad: false,
theme: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'default',
},
Comment on lines +130 to +133
},
}),
Title,
{
provide: HTTP_INTERCEPTORS,
Expand Down
Loading