Use the psychic tiny keys library

This commit is contained in:
root
2022-01-10 15:19:36 +05:30
parent ab35cdb92f
commit 1d4ce02723
5 changed files with 13 additions and 26 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ import shaka from 'shaka-player/dist/shaka-player.ui.js'
import 'shaka-player/dist/controls.css'
import { DashUtils } from '@/tools/DashUtils'
import { setupKeybindings } from '@/plugins/keybindings'
import { setupKeybindings } from 'psychic-tiny-keys'
window.muxjs = muxjs
-19
View File
@@ -1,19 +0,0 @@
import tinykeys from 'tinykeys'
export function setupKeybindings (el, bindings, ...extra) {
const newBindings = {}
for (const [k, f] of Object.entries(bindings)) {
newBindings[k] = (ev, ...args) => {
const active = ev.target
const enteringText = active instanceof HTMLElement &&
(active.isContentEditable ||
active.tagName === 'INPUT' ||
active.tagName === 'TEXTAREA' ||
active.tagName === 'SELECT'
)
if (!enteringText) return f(ev, ...args)
}
}
return tinykeys(el, newBindings, ...extra)
}
+1 -1
View File
@@ -17,7 +17,7 @@
</template>
<script>
import { setupKeybindings } from '@/plugins/keybindings'
import { setupKeybindings } from 'psychic-tiny-keys'
export default {
name: 'SearchMenu',