updated help mode to open directly the docs if there is only one key for a specific view
This commit is contained in:
parent
efc2868938
commit
c8f9a1b5d3
@ -1,13 +1,13 @@
|
||||
<iqser-icon-button
|
||||
*ngIf="dialogButton"
|
||||
(action)="helpModeService.activateHelpMode(true)"
|
||||
(action)="activateHelpMode()"
|
||||
icon="iqser:help-outline"
|
||||
type="help"
|
||||
[label]="'help-mode.button-text' | translate"
|
||||
></iqser-icon-button>
|
||||
<iqser-circle-button
|
||||
*ngIf="!dialogButton"
|
||||
(action)="helpModeService.activateHelpMode()"
|
||||
(action)="activateHelpMode()"
|
||||
icon="iqser:help-outline"
|
||||
type="help"
|
||||
[tooltip]="'help-mode.button-text' | translate"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { HelpModeService } from '@iqser/common-ui';
|
||||
|
||||
@Component({
|
||||
@ -6,8 +6,26 @@ import { HelpModeService } from '@iqser/common-ui';
|
||||
templateUrl: './help-button.component.html',
|
||||
styleUrls: ['./help-button.component.scss'],
|
||||
})
|
||||
export class HelpButtonComponent {
|
||||
export class HelpButtonComponent implements OnInit, OnDestroy {
|
||||
@Input() dialogButton = true;
|
||||
@Input() helpButtonKey?: string;
|
||||
|
||||
constructor(readonly helpModeService: HelpModeService) {}
|
||||
constructor(private readonly _helpModeService: HelpModeService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this._helpModeService.helpButtonKey = this.helpButtonKey;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this._helpModeService.helpButtonKey = null;
|
||||
}
|
||||
|
||||
activateHelpMode(): void {
|
||||
if (this.helpButtonKey) {
|
||||
const url = this._helpModeService.getDocsLink(this.helpButtonKey);
|
||||
window.open(url, '_blank');
|
||||
return;
|
||||
}
|
||||
this._helpModeService.activateHelpMode(this.dialogButton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,8 @@ export class HelpModeService {
|
||||
|
||||
private _dialogMode = false;
|
||||
|
||||
helpButtonKey: string | null = null;
|
||||
|
||||
constructor(
|
||||
@Inject(HELP_DOCS) private readonly _docs: Record<string, Record<string, string>>,
|
||||
@Inject(MANUAL_BASE_URL) private readonly _manualBaseURL: string,
|
||||
|
||||
@ -22,6 +22,11 @@ export class HelpModeComponent {
|
||||
@HostListener('document:keydown.h', ['$event']) onHKeydownHandler(event: KeyboardEvent): void {
|
||||
const node = (event.target as IqserEventTarget).localName;
|
||||
if (!this.helpModeService.isHelpModeActive && node !== 'input' && node !== 'textarea') {
|
||||
if (this.helpModeService.helpButtonKey) {
|
||||
const url = this.helpModeService.getDocsLink(this.helpModeService.helpButtonKey);
|
||||
window.open(url, '_blank');
|
||||
return;
|
||||
}
|
||||
const dialogMode = !!this._dialog.openDialogs.length;
|
||||
this.helpModeService.activateHelpMode(dialogMode);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user