Add `@github/hotkey`

This commit is contained in:
Karina Kwiatek 2023-02-07 23:57:36 +01:00
parent b5193cd1ac
commit 1a2650e810
4 changed files with 16 additions and 0 deletions

View File

@ -1,11 +1,13 @@
import '@hotwired/turbo-rails';
import initializeBootstrap from './initializers/bootstrap';
import initializeHotkey from './initializers/hotkey';
import initializeServiceWorker from './initializers/serviceWorker';
import initializeStimulus from './initializers/stimulus';
export default function start(): void {
try {
initializeBootstrap();
initializeHotkey();
initializeServiceWorker();
initializeStimulus();
} catch (e) {

View File

@ -0,0 +1,8 @@
import { install } from '@github/hotkey'
export default function (): void {
document.addEventListener('turbo:load', () => {
console.debug("Init Hotkey.")
document.querySelectorAll('[data-hotkey]').forEach(el => install(el as HTMLElement));
});
}

View File

@ -9,6 +9,7 @@
"dependencies": {
"@fontsource/lexend": "^4.5.15",
"@fortawesome/fontawesome-free": "^6.4.0",
"@github/hotkey": "^2.0.1",
"@hotwired/stimulus": "^3.2.1",
"@hotwired/turbo-rails": "^7.3.0",
"@melloware/coloris": "^0.19.1",

View File

@ -184,6 +184,11 @@
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.4.0.tgz#1ee0c174e472c84b23cb46c995154dc383e3b4fe"
integrity sha512-0NyytTlPJwB/BF5LtRV8rrABDbe3TdTXqNB3PdZ+UUUZAEIrdOJdmABqKjt4AXwIoJNaRVVZEXxpNrqvE1GAYQ==
"@github/hotkey@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@github/hotkey/-/hotkey-2.0.1.tgz#24ad6b49313cee5b98368174eab16a4b53a08ec7"
integrity sha512-qKXjAJjtheJbf4ie3hi8IwrHWJZHB5qdojR6JGo6jvQNPpsdUbk/NIdU8sxu4PW41CjW80vfciDMu3MAP3j2Fg==
"@hotwired/stimulus@^3.2.1":
version "3.2.1"
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.1.tgz#e3de23623b0c52c247aba4cd5d530d257008676b"