function handleKeyDown()

in karavan-designer/src/designer/route/useRouteDesignerHook.tsx [158:176]


    function handleKeyDown(event: KeyboardEvent) {
        if ((event.shiftKey)) {
            setShiftKeyPressed(true);
        }
        if (window.document.hasFocus() && window.document.activeElement) {
            if (['BODY', 'MAIN'].includes(window.document.activeElement.tagName)) {
                let charCode = String.fromCharCode(event.which).toLowerCase();
                if ((event.ctrlKey || event.metaKey) && charCode === 'c') {
                    copyToClipboard();
                } else if ((event.ctrlKey || event.metaKey) && charCode === 'v') {
                    pasteFromClipboard();
                }
            }
        } else {
            if (event.repeat) {
                window.dispatchEvent(event);
            }
        }
    }