(e: KeyboardEvent)
| 249 | // Keyboard shortcut |
| 250 | useEffect(() => { |
| 251 | const handleKeyDown = (e: KeyboardEvent) => { |
| 252 | if ((e.metaKey || e.ctrlKey) && e.key === 's') { |
| 253 | e.preventDefault(); |
| 254 | // Only save if action is valid (dirty or new) and not saving |
| 255 | const canSave = (isDirty || isNew) && !isSaving; |
| 256 | if (canSave) { |
| 257 | handleSave(); |
| 258 | } |
| 259 | } |
| 260 | }; |
| 261 | window.addEventListener('keydown', handleKeyDown); |
| 262 | return () => window.removeEventListener('keydown', handleKeyDown); |
| 263 | }, [handleSave, isDirty, isNew, isSaving]); |
nothing calls this directly
no test coverage detected