Configurable manual base URL
This commit is contained in:
parent
b808e4661e
commit
e5794fd772
@ -3,7 +3,7 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { BehaviorSubject, firstValueFrom } from 'rxjs';
|
import { BehaviorSubject, firstValueFrom } from 'rxjs';
|
||||||
import { HelpModeDialogComponent } from './help-mode-dialog/help-mode-dialog.component';
|
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 {
|
interface Helper {
|
||||||
readonly element: HTMLElement;
|
readonly element: HTMLElement;
|
||||||
@ -25,6 +25,7 @@ export class HelpModeService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(HELP_DOCS) private readonly _docs: Record<string, Record<string, string>>,
|
@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 _dialog: MatDialog,
|
||||||
private readonly _rendererFactory: RendererFactory2,
|
private readonly _rendererFactory: RendererFactory2,
|
||||||
private readonly _translateService: TranslateService,
|
private readonly _translateService: TranslateService,
|
||||||
@ -55,7 +56,7 @@ export class HelpModeService {
|
|||||||
|
|
||||||
openDocsFor(elementName: string): void {
|
openDocsFor(elementName: string): void {
|
||||||
if (this.isHelpModeActive) {
|
if (this.isHelpModeActive) {
|
||||||
window.open(this._docs[elementName][this._translateService.currentLang]);
|
window.open(`${this._manualBaseURL}${this._docs[elementName][this._translateService.currentLang]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
import { InjectionToken } from '@angular/core';
|
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 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');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user