fix caps on focus and ios/android disabled display

This commit is contained in:
Utkarsh Agarwal
2025-10-19 20:22:45 +05:30
parent f11efe7278
commit 6bfcb30592

View File

@@ -84,9 +84,10 @@ const init = () => {
});
window.addEventListener('keydown', function (e) {
const key = e.key.toLowerCase();
const isMac = navigator.userAgent.toUpperCase().includes('MAC');
const isCtrlK = e.ctrlKey && e.key === 'k';
const isCmdK = isMac && e.metaKey && e.key === 'k';
const isCtrlK = e.ctrlKey && key === 'k';
const isCmdK = isMac && e.metaKey && key === 'k';
if (isCtrlK || isCmdK) {
e.preventDefault();
@@ -95,9 +96,15 @@ const init = () => {
});
const shortcutK = document.getElementById('shortcut');
shortcutK.textContent = navigator.userAgent.toUpperCase().includes('MAC')
? '⌘ K'
: 'Ctrl K';
const isIosOrAndroid = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
if (isIosOrAndroid) {
shortcutK.style.display = 'none';
} else {
shortcutK.textContent = navigator.userAgent.toUpperCase().includes('MAC')
? '⌘ + K'
: 'Ctrl + K';
}
dom.toolGrid.addEventListener('click', (e) => {
// @ts-expect-error TS(2339) FIXME: Property 'closest' does not exist on type 'EventTa... Remove this comment to see the full error message