Create polished demo videos without editing skills. Mac/Windows/Linux
fix all CodeRabbits command
Alan Trebugeais7f9d78ca8492
diff --git a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsxindex c176b642..f21ec727 100644--- a/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx+++ b/src/components/video-editor/timeline/components/viewport/TimelineCanvas.tsx@@ -450,7 +450,10 @@ export default function TimelineCanvas({}const rect = e.currentTarget.getBoundingClientRect();- const clickX = e.clientX - rect.left - sidebarWidth;+ const clickX =+ direction === "rtl"+ ? rect.right - sidebarWidth - e.clientX+ : e.clientX - rect.left - sidebarWidth;if (clickX < 0) return;const relativeMs = pixelsToValue(clickX);const absoluteMs = Math.max(0, Math.min(range.start + relativeMs, videoDurationMs));@@ -465,6 +468,7 @@ export default function TimelineCanvas({onClearBlockSelection,videoDurationMs,sidebarWidth,+ direction,range.start,pixelsToValue,],diff --git a/src/components/video-editor/timeline/core/constants.ts b/src/components/video-editor/timeline/core/constants.tsindex e13a204d..1b71e996 100644--- a/src/components/video-editor/timeline/core/constants.ts+++ b/src/components/video-editor/timeline/core/constants.ts@@ -3,7 +3,7 @@ export const CLIP_ROW_ID = "row-clip";export const ANNOTATION_ROW_ID = "row-annotation";export const AUDIO_ROW_ID = "row-audio";export const ANNOTATION_ROW_PREFIX = `${ANNOTATION_ROW_ID}-`;-export const AUDIO_ROW_PREFIX = "row-audio-";+export const AUDIO_ROW_PREFIX = `${AUDIO_ROW_ID}-`;export const FALLBACK_RANGE_MS = 1000;export const TARGET_MARKER_COUNT = 12;diff --git a/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts b/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.tsindex 129cfb33..15233f86 100644--- a/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts+++ b/src/components/video-editor/timeline/hooks/useTimelineEditorRuntime.ts@@ -214,7 +214,8 @@ export function useTimelineEditorRuntime({return;}- const startPos = Math.max(0, Math.min(currentTimeMs, totalMs));+ const latestStartPos = Math.max(0, totalMs - defaultDuration);+ const startPos = Math.max(0, Math.min(currentTimeMs, latestStartPos));const endPos = Math.min(startPos + defaultDuration, totalMs);onAnnotationAdded({ start: startPos, end: endPos }, trackIndex);},diff --git a/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts b/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.tsindex 6d8e8a11..55d2c0b6 100644--- a/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts+++ b/src/components/video-editor/timeline/hooks/useTimelineKeyboardShortcuts.ts@@ -58,12 +58,22 @@ export function useTimelineKeyboardShortcuts({}: UseTimelineKeyboardShortcutsParams) {useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {- if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {+ const eventTarget = e.target;+ if (+ eventTarget instanceof HTMLInputElement ||+ eventTarget instanceof HTMLTextAreaElement ||+ eventTarget instanceof HTMLSelectElement ||+ (eventTarget instanceof HTMLElement && eventTarget.isContentEditable)+ ) {+ return;+ }++ if (!isTimelineFocusedRef.current) {return;}if (matchesShortcut(e, { key: "a", ctrl: true }, isMac)) {- if (!hasAnyTimelineBlocks || !isTimelineFocusedRef.current) {+ if (!hasAnyTimelineBlocks) {return;}e.preventDefault();diff --git a/src/components/video-editor/timeline/hooks/useTimelineNormalization.ts b/src/components/video-editor/timeline/hooks/useTimelineNormalization.tsindex f5d7d48e..1b4fd498 100644--- a/src/components/video-editor/timeline/hooks/useTimelineNormalization.ts+++ b/src/components/video-editor/timeline/hooks/useTimelineNormalization.ts@@ -1,4 +1,4 @@-import { useEffect, useRef } from "react";+import { useEffect } from "react";import { normalizeRegionSpan } from "../core/spans";import type { AudioRegion, SpeedRegion, TrimRegion, ZoomRegion } from "../../types";@@ -27,21 +27,12 @@ export function useTimelineNormalization({onSpeedSpanChange,onAudioSpanChange,}: UseTimelineNormalizationParams) {- const zoomRegionsRef = useRef(zoomRegions);- const trimRegionsRef = useRef(trimRegions);- const speedRegionsRef = useRef(speedRegions);- const audioRegionsRef = useRef(audioRegions);- zoomRegionsRef.current = zoomRegions;- trimRegionsRef.current = trimRegions;- speedRegionsRef.current = speedRegions;- audioRegionsRef.current = audioRegions;-useEffect(() => {if (totalMs === 0 || safeMinDurationMs <= 0) {return;}- zoomRegionsRef.current.forEach((region) => {+ zoomRegions.forEach((region) => {const normalized = normalizeRegionSpan({startMs: region.startMs,endMs: region.endMs,@@ -54,7 +45,7 @@ export function useTimelineNormalization({}});- trimRegionsRef.current.forEach((region) => {+ trimRegions.forEach((region) => {const normalized = normalizeRegionSpan({startMs: region.startMs,endMs: region.endMs,@@ -67,7 +58,7 @@ export function useTimelineNormalization({}});- speedRegionsRef.current.forEach((region) => {+ speedRegions.forEach((region) => {const normalized = normalizeRegionSpan({startMs: region.startMs,endMs: region.endMs,@@ -80,7 +71,7 @@ export function useTimelineNormalization({}});- audioRegionsRef.current.forEach((region) => {+ audioRegions.forEach((region) => {const normalized = normalizeRegionSpan({startMs: region.startMs,endMs: region.endMs,@@ -95,6 +86,10 @@ export function useTimelineNormalization({}, [totalMs,safeMinDurationMs,+ zoomRegions,+ trimRegions,+ speedRegions,+ audioRegions,onZoomSpanChange,onTrimSpanChange,onSpeedSpanChange,