Initial commit: NexusArchitect Professional Workstation Overhaul
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export function attachKeyboardListener(dotNetHelper) {
|
||||
const handler = (e) => {
|
||||
// Exclude inputs, textareas, etc.
|
||||
const activeNode = document.activeElement ? document.activeElement.nodeName.toLowerCase() : '';
|
||||
if (activeNode === 'input' || activeNode === 'textarea') return;
|
||||
|
||||
if (e.key === 'f' || e.key === 'F') {
|
||||
dotNetHelper.invokeMethodAsync('OnFocusKeypressed');
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handler);
|
||||
return handler;
|
||||
}
|
||||
|
||||
export function detachKeyboardListener(handler) {
|
||||
if (handler) {
|
||||
window.removeEventListener('keydown', handler);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user