Merge branch 'issue-33-missing-hotkeys' into 'master'

Fix linting issues.

See merge request openlp/web-remote!52
This commit is contained in:
Raoul Snyman 2023-02-08 17:41:37 +00:00
commit 265aafa67d
2 changed files with 14 additions and 14 deletions

View File

@ -71,19 +71,19 @@ export class AppComponent implements OnInit {
); );
this.hotKeysService.addShortcut({ keys: 'Space' }).subscribe(_ => this.hotKeysService.addShortcut({ keys: 'Space' }).subscribe(_ =>
{ {
if (this.state.displayMode != DisplayMode.Presentation) { if (this.state.displayMode !== DisplayMode.Presentation) {
this.showDisplay(); this.showDisplay();
} }
} }
); );
this.hotKeysService.addShortcut({ keys: 't' }).subscribe(_ => this.hotKeysService.addShortcut({ keys: 't' }).subscribe(_ =>
this.state.displayMode == DisplayMode.Theme ? this.showDisplay() : this.themeDisplay() this.state.displayMode === DisplayMode.Theme ? this.showDisplay() : this.themeDisplay()
); );
this.hotKeysService.addShortcut({ keys: 'code.Period' }).subscribe(_ => this.hotKeysService.addShortcut({ keys: 'code.Period' }).subscribe(_ =>
this.state.displayMode == DisplayMode.Blank ? this.showDisplay() : this.blankDisplay() this.state.displayMode === DisplayMode.Blank ? this.showDisplay() : this.blankDisplay()
); );
this.hotKeysService.addShortcut({ keys: 'd' }).subscribe(_ => this.hotKeysService.addShortcut({ keys: 'd' }).subscribe(_ =>
this.state.displayMode == DisplayMode.Desktop ? this.showDisplay() : this.desktopDisplay() this.state.displayMode === DisplayMode.Desktop ? this.showDisplay() : this.desktopDisplay()
); );
} }

View File

@ -1,18 +1,18 @@
import { DOCUMENT } from "@angular/common"; import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from "@angular/core"; import { Inject, Injectable } from '@angular/core';
import { EventManager } from "@angular/platform-browser"; import { EventManager } from '@angular/platform-browser';
import { Observable } from "rxjs"; import { Observable } from 'rxjs';
type Options = { interface Options {
element: any; element: any;
keys: string; keys: string;
} };
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class HotKeysService { export class HotKeysService {
defaults: Partial<Options> = { defaults: Partial<Options> = {
element: this.document element: this.document
} };
constructor(private eventManager: EventManager, @Inject(DOCUMENT) private document: Document) { constructor(private eventManager: EventManager, @Inject(DOCUMENT) private document: Document) {
} }
@ -25,7 +25,7 @@ export class HotKeysService {
const handler = (e: KeyboardEvent) => { const handler = (e: KeyboardEvent) => {
if (document.URL.endsWith('/slides')) if (document.URL.endsWith('/slides'))
{ {
e.preventDefault() e.preventDefault();
observer.next(e); observer.next(e);
} }
}; };
@ -37,6 +37,6 @@ export class HotKeysService {
return () => { return () => {
dispose(); dispose();
}; };
}) });
} }
} }