From d9d8dcc7f419dbcecef062110dc41b57899056f7 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Mon, 14 Feb 2022 11:13:34 +0200 Subject: [PATCH] check if body contains helper element before removing it --- src/lib/help-mode/help-mode.service.ts | 6 ++++-- src/lib/listing/page-header/models/button-config.model.ts | 1 - src/lib/listing/page-header/page-header.component.html | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/help-mode/help-mode.service.ts b/src/lib/help-mode/help-mode.service.ts index fd2cba9..65f6107 100644 --- a/src/lib/help-mode/help-mode.service.ts +++ b/src/lib/help-mode/help-mode.service.ts @@ -54,7 +54,7 @@ export class HelpModeService { } getDocsLink(elementName: string): string { - return `${this._manualBaseURL}${this._docs[elementName][this._translateService.currentLang]}`; + return this._docs[elementName] ? `${this._manualBaseURL}${this._docs[elementName][this._translateService.currentLang]}` : ''; } activateHelpMode(): void { @@ -112,7 +112,9 @@ export class HelpModeService { private _disableHelperElements() { Object.values(this._helperElements).forEach(({ helperElement }) => { - document.body.removeChild(helperElement) + if (document.body.contains(helperElement)) { + document.body.removeChild(helperElement); + } }); } diff --git a/src/lib/listing/page-header/models/button-config.model.ts b/src/lib/listing/page-header/models/button-config.model.ts index a51a41e..67ab4d8 100644 --- a/src/lib/listing/page-header/models/button-config.model.ts +++ b/src/lib/listing/page-header/models/button-config.model.ts @@ -3,5 +3,4 @@ import { ActionConfig } from './action-config.model'; export interface ButtonConfig extends ActionConfig { readonly type?: IconButtonType; - readonly helpModeKey?: string; } diff --git a/src/lib/listing/page-header/page-header.component.html b/src/lib/listing/page-header/page-header.component.html index 187bbd9..3bb6c79 100644 --- a/src/lib/listing/page-header/page-header.component.html +++ b/src/lib/listing/page-header/page-header.component.html @@ -44,6 +44,7 @@ [icon]="config.icon" [tooltip]="config.label" tooltipPosition="below" + [iqserHelpMode]="config.helpModeKey" >