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
@@ -24,10 +24,10 @@
"lodash-es": "^4.17.21",
"marked": "^3.0.8",
"mux.js": "^5.14.1",
"psychic-tiny-keys": "https://git.maharshi.ninja/root/psychic-tiny-keys/archive/v0.0.1.tar.gz",
"register-service-worker": "^1.7.2",
"sass-loader": "^10",
"shaka-player": "^3.2.1",
"tinykeys": "^1.2.0",
"vue": "^2.6.14",
"vue-i18n": "^8.26.7",
"vue-json-viewer": "^2.2.20",
+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',
+10 -4
View File
@@ -7403,6 +7403,12 @@ psl@^1.1.28:
resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==
"psychic-tiny-keys@https://git.maharshi.ninja/root/psychic-tiny-keys/archive/v0.0.1.tar.gz":
version "0.0.0"
resolved "https://git.maharshi.ninja/root/psychic-tiny-keys/archive/v0.0.1.tar.gz#53ded9a6f68e9425d8076058f401fda2412cf60c"
dependencies:
tinykeys "^1.3.0"
public-encrypt@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0"
@@ -8708,10 +8714,10 @@ tiny-emitter@^2.0.0:
resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423"
integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==
tinykeys@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/tinykeys/-/tinykeys-1.2.0.tgz#c57ad1b6f088bc2e506ea340755d57634a3d5c6c"
integrity sha512-zrTdr+78Akihb5TAxmLKG8OAKIpyKWHk/YIOyA90UuDPzJ0OHf4RHR/TwmABgNMXLca1LOUhRf6NpOFIIKezyA==
tinykeys@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/tinykeys/-/tinykeys-1.3.0.tgz#c05d218624b560d26a34778e020fec0179a21662"
integrity sha512-TDBxX+4lMMk0eq9WpYdKIlnMNGOb1bfDSF2E76OTfXYuRXJObvA8l5zW/CiiJJzD/2oldLsh/EC+93CJavp6mA==
tmp@^0.0.33:
version "0.0.33"