Configurable manual base URL

This commit is contained in:
Adina Țeudan 2022-02-07 18:20:03 +02:00
parent b808e4661e
commit e5794fd772
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, firstValueFrom } from 'rxjs';
import { HelpModeDialogComponent } from './help-mode-dialog/help-mode-dialog.component';
import { HELP_DOCS } from './tokens';
import { HELP_DOCS, MANUAL_BASE_URL } from './tokens';
interface Helper {
readonly element: HTMLElement;
@ -25,6 +25,7 @@ export class HelpModeService {
constructor(
@Inject(HELP_DOCS) private readonly _docs: Record<string, Record<string, string>>,
@Inject(MANUAL_BASE_URL) private readonly _manualBaseURL: string,
private readonly _dialog: MatDialog,
private readonly _rendererFactory: RendererFactory2,
private readonly _translateService: TranslateService,
@ -55,7 +56,7 @@ export class HelpModeService {
openDocsFor(elementName: string): void {
if (this.isHelpModeActive) {
window.open(this._docs[elementName][this._translateService.currentLang]);
window.open(`${this._manualBaseURL}${this._docs[elementName][this._translateService.currentLang]}`);
}
}

View File

@ -1,3 +1,4 @@
import { InjectionToken } from '@angular/core';
export const HELP_DOCS = new InjectionToken<Record<string, Record<string, string>>>('Links to user manual or help docs');
export const MANUAL_BASE_URL = new InjectionToken<Record<string, Record<string, string>>>('Base manual URL');