()
| 45 | }; |
| 46 | |
| 47 | const commitChange = () => { |
| 48 | try { |
| 49 | const frames = parseTimecode(text, fps); |
| 50 | onChange(frames / fps); |
| 51 | setError(false); |
| 52 | setIsEditing(false); |
| 53 | } catch (e) { |
| 54 | console.warn("Invalid timecode:", text); |
| 55 | setError(true); |
| 56 | // Don't leave edit mode on error, or revert? |
| 57 | // Reverting behavior: |
| 58 | const frame = Math.round((value || 0) * fps); |
| 59 | setText(framesToTimecode(frame, fps)); |
| 60 | setIsEditing(false); |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => { |
| 65 | if (e.key === 'Enter') { |
nothing calls this directly
no test coverage detected