diff --git a/packages/plugins/CHANGELOG.md b/packages/plugins/CHANGELOG.md index 8d39ba51..ea9d726e 100644 --- a/packages/plugins/CHANGELOG.md +++ b/packages/plugins/CHANGELOG.md @@ -2,6 +2,11 @@ ## UnRelease +## 1.0.10-beta.1 + +- playlist + - add keyboard `l`. + ## 1.0.10-beta.0 - playlist diff --git a/packages/plugins/package.json b/packages/plugins/package.json index dabbe7a6..6b122e82 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/plugins", - "version": "1.0.10-beta.0", + "version": "1.0.10-beta.1", "description": "oplayer's plugin", "type": "module", "main": "dist/index.es.js", diff --git a/packages/plugins/src/playlist.css b/packages/plugins/src/playlist.css index a6ef0ac3..858c642f 100644 --- a/packages/plugins/src/playlist.css +++ b/packages/plugins/src/playlist.css @@ -90,6 +90,7 @@ height: 5em; cursor: pointer; box-sizing: border-box; + overflow: hidden; } .playlist-list-item > * { diff --git a/packages/plugins/src/playlist.ts b/packages/plugins/src/playlist.ts index c1e9afd5..ae7d1bf3 100644 --- a/packages/plugins/src/playlist.ts +++ b/packages/plugins/src/playlist.ts @@ -75,6 +75,11 @@ export default class PlaylistPlugin implements PlayerPlugin { this.next() }) } + this.player.context.ui.keyboard.register({ + l: () => { + this.$root.classList.toggle('active') + } + }) } const { initialIndex, m3uList, sources } = this.options diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 89733b1e..4fc6957f 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -2,11 +2,14 @@ ## UnRelease +## [1.2.36-beta.0] + - any px -> rem. - ErrorBuilder custom params. - add keyboard. - k: play | pause - m: mute | unmute +- fix global keyboard not working. ## [1.2.35] diff --git a/packages/ui/package.json b/packages/ui/package.json index fb8b2a4d..3002d69d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/ui", - "version": "1.2.35", + "version": "1.2.36-beta.0", "description": "ui plugin for oplayer", "type": "module", "main": "./dist/index.es.js", diff --git a/packages/ui/src/functions/keyboard.ts b/packages/ui/src/functions/keyboard.ts index 84496e81..d6516cae 100644 --- a/packages/ui/src/functions/keyboard.ts +++ b/packages/ui/src/functions/keyboard.ts @@ -64,13 +64,17 @@ const KEY_FN: Record void> = { export default function (it: UIInterface) { const { player, config } = it + if (typeof config.keyboard == 'undefined') { + config.keyboard = { focused: true } + } + function keydown(e: KeyboardEvent) { if ( document.activeElement?.tagName == 'INPUT' || document.activeElement?.tagName == 'TEXTAREA' || document.activeElement?.getAttribute('contenteditable') || - (!config.keyboard?.global && !config.keyboard?.focused) || - (config.keyboard.focused && !isFocused(player)) || + (!config.keyboard!.global && !config.keyboard!.focused) || + (config.keyboard!.focused && !isFocused(player)) || e.altKey || e.ctrlKey || e.metaKey || diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 918076aa..58b8be06 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -33,7 +33,6 @@ const defaultConfig: UiConfig = { forceLandscapeOnFullscreen: true, showControls: 'always', - keyboard: { focused: true }, settings: ['loop'], theme: { primaryColor: '#6668ab' }, speeds: ['2.0', '1.5', '1.25', '1.0', '0.75', '0.5'],