Mercurial > code > home > repos > video
changeset 31:f7236339097e
esc key to close video
author | drewp@bigasterisk.com |
---|---|
date | Mon, 26 Aug 2024 22:33:44 -0700 |
parents | 1fa90a903621 |
children | d83dbda8bccf |
files | src/VideoPage.ts |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/VideoPage.ts Mon Aug 26 22:33:02 2024 -0700 +++ b/src/VideoPage.ts Mon Aug 26 22:33:44 2024 -0700 @@ -1,4 +1,4 @@ -import { LitElement, css, html, unsafeCSS } from "lit"; +import { LitElement, PropertyValues, css, html, unsafeCSS } from "lit"; import { customElement, property } from "lit/decorators.js"; import { PagePlayer, ShakaVideoElement } from "./PagePlayer"; import maincss from "./main.css?inline"; @@ -33,6 +33,13 @@ this.pathSegs = []; this.loadVideos(); } + protected firstUpdated(_changedProperties: PropertyValues): void { + document.addEventListener("keydown", (e) => { + if (e.key == "Escape") { + this.closePlayer(); + } + }); + } updatePathSegs(subdir: string) { this.pathSegs = [{ label: "TOP", subdir: "/" }]; if (subdir != "/") {