mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Use the psychic tiny keys library
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setupKeybindings } from '@/plugins/keybindings'
|
||||
import { setupKeybindings } from 'psychic-tiny-keys'
|
||||
|
||||
export default {
|
||||
name: 'SearchMenu',
|
||||
|
||||
Reference in New Issue
Block a user