@github/hotkey
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -84,3 +84,7 @@ class Leaf { | ||
} | ||
function fireDeterminedAction(el) { | ||
function fireDeterminedAction(el, path) { | ||
const delegateEvent = new CustomEvent('hotkey-fire', { cancelable: true, detail: { path } }); | ||
const cancelled = !el.dispatchEvent(delegateEvent); | ||
if (cancelled) | ||
return; | ||
if (isFormField(el)) { | ||
@@ -106,3 +110,5 @@ el.focus(); | ||
let resetTriePositionTimer = null; | ||
let path = []; | ||
function resetTriePosition() { | ||
path = []; | ||
resetTriePositionTimer = null; | ||
@@ -132,2 +138,3 @@ currentTriePosition = hotkeyRadixTrie; | ||
} | ||
path.push(hotkey(event)); | ||
currentTriePosition = newTriePosition; | ||
@@ -148,3 +155,3 @@ if (newTriePosition instanceof Leaf) { | ||
if (elementToFire && shouldFire) { | ||
fireDeterminedAction(elementToFire); | ||
fireDeterminedAction(elementToFire, path); | ||
event.preventDefault(); | ||
@@ -151,0 +158,0 @@ } |
export declare function isFormField(element: Node): boolean; | ||
export declare function fireDeterminedAction(el: HTMLElement): void; | ||
export declare function fireDeterminedAction(el: HTMLElement, path: string[]): void; | ||
export declare function expandHotkeyToEdges(hotkey: string): string[][]; |
@@ -12,3 +12,7 @@ export function isFormField(element) { | ||
} | ||
export function fireDeterminedAction(el) { | ||
export function fireDeterminedAction(el, path) { | ||
const delegateEvent = new CustomEvent('hotkey-fire', { cancelable: true, detail: { path } }); | ||
const cancelled = !el.dispatchEvent(delegateEvent); | ||
if (cancelled) | ||
return; | ||
if (isFormField(el)) { | ||
@@ -15,0 +19,0 @@ el.focus(); |
{ | ||
"name": "@github/hotkey", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15620
301