Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(video-editor): address CodeRabbit review of region clipboard

EtienneLescot7a6ccd321821
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index 91c9c624f..96da01f28 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -1671,13 +1671,17 @@ export default function VideoEditor() {
for (const [id, regions, extract, kind] of copyTargets) {
if (!id) continue;
const region = (regions as readonly { id: string }[]).find((r) => r.id === id);
- if (region) {
- // Each row pairs a region list with its matching extractor, so the cast is sound.
- setCopiedRegion((extract as (r: never) => CopiedRegion)(region as never));
- toast.success(t("regionClipboard.copied", { region: t(`regionClipboard.kinds.${kind}`) }), {
+ if (!region) continue; // Stale id — try the next target so the fallback toast stays reachable.
+ // Each row pairs a region list with its matching extractor, so the cast is sound.
+ setCopiedRegion((extract as (r: never) => CopiedRegion)(region as never));
+ // Blur lives in annotationRegions (type "blur") but its toast must label as "blur", not "text".
+ const labelKind = (region as { type?: string }).type === "blur" ? "blur" : kind;
+ toast.success(
+ t("regionClipboard.copied", { region: t(`regionClipboard.kinds.${labelKind}`) }),
+ {
id: "regionClipboard.copied",
- });
- }
+ },
+ );
return;
}
toast.info(t("regionClipboard.nothingToCopy"));
diff --git a/src/components/video-editor/regionPlacement.test.ts b/src/components/video-editor/regionPlacement.test.ts
index 6268776f9..ecddf2ff6 100644
--- a/src/components/video-editor/regionPlacement.test.ts
+++ b/src/components/video-editor/regionPlacement.test.ts
@@ -29,6 +29,12 @@ describe("findFreeGapAt", () => {
expect(gapMs).toBe(0);
});
+ it("rejects placement that lands exactly on a region's startMs", () => {
+ const regions = [{ startMs: 5000, endMs: 7000 }];
+ const { ok } = findFreeGapAt(regions, 5000, totalMs);
+ expect(ok).toBe(false);
+ });
+
it("allows placement adjacent to (exactly at the end of) an existing region", () => {
const regions = [{ startMs: 0, endMs: 2000 }];
const { ok, gapMs } = findFreeGapAt(regions, 2000, totalMs);
diff --git a/src/i18n/locales/ar/editor.json b/src/i18n/locales/ar/editor.json
index e658d08c2..55ba4339c 100644
--- a/src/i18n/locales/ar/editor.json
+++ b/src/i18n/locales/ar/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "تكبير",
"speed": "سرعة",
- "annotation": "نص"
+ "annotation": "نص",
+ "blur": "تمويه"
}
}
}
diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.json
index 79b7d7126..5810c45c6 100644
--- a/src/i18n/locales/en/editor.json
+++ b/src/i18n/locales/en/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Zoom",
"speed": "Speed",
- "annotation": "Text"
+ "annotation": "Text",
+ "blur": "Blur"
}
}
}
diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.json
index b028479a5..c2c3a910e 100644
--- a/src/i18n/locales/es/editor.json
+++ b/src/i18n/locales/es/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Zoom",
"speed": "Velocidad",
- "annotation": "Texto"
+ "annotation": "Anotación",
+ "blur": "Desenfoque"
}
}
}
diff --git a/src/i18n/locales/fr/editor.json b/src/i18n/locales/fr/editor.json
index e1a8e3e82..60d35285f 100644
--- a/src/i18n/locales/fr/editor.json
+++ b/src/i18n/locales/fr/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Zoom",
"speed": "Vitesse",
- "annotation": "Texte"
+ "annotation": "Annotation",
+ "blur": "Flou"
}
}
}
diff --git a/src/i18n/locales/it/editor.json b/src/i18n/locales/it/editor.json
index 4cc2fe326..41e6244ea 100644
--- a/src/i18n/locales/it/editor.json
+++ b/src/i18n/locales/it/editor.json
@@ -70,7 +70,8 @@
"kinds": {
"zoom": "Zoom",
"speed": "Velocità",
- "annotation": "Testo"
+ "annotation": "Annotazione",
+ "blur": "Sfocatura"
}
}
}
diff --git a/src/i18n/locales/ja-JP/editor.json b/src/i18n/locales/ja-JP/editor.json
index 9291cdeae..9713c1a62 100644
--- a/src/i18n/locales/ja-JP/editor.json
+++ b/src/i18n/locales/ja-JP/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "ズーム",
"speed": "速度",
- "annotation": "テキスト"
+ "annotation": "注釈",
+ "blur": "ぼかし"
}
}
}
diff --git a/src/i18n/locales/ko-KR/editor.json b/src/i18n/locales/ko-KR/editor.json
index ff52a36c9..f3e995895 100644
--- a/src/i18n/locales/ko-KR/editor.json
+++ b/src/i18n/locales/ko-KR/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "줌",
"speed": "속도",
- "annotation": "텍스트"
+ "annotation": "주석",
+ "blur": "블러"
}
}
}
diff --git a/src/i18n/locales/pt-BR/editor.json b/src/i18n/locales/pt-BR/editor.json
index 29e1436cf..2188ec15a 100644
--- a/src/i18n/locales/pt-BR/editor.json
+++ b/src/i18n/locales/pt-BR/editor.json
@@ -69,7 +69,8 @@
"kinds": {
"zoom": "Zoom",
"speed": "Velocidade",
- "annotation": "Texto"
+ "annotation": "Anotação",
+ "blur": "Desfoque"
}
}
}
diff --git a/src/i18n/locales/ru/editor.json b/src/i18n/locales/ru/editor.json
index 3820315ca..c45501c32 100644
--- a/src/i18n/locales/ru/editor.json
+++ b/src/i18n/locales/ru/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Масштаб",
"speed": "Скорость",
- "annotation": "Текст"
+ "annotation": "Аннотация",
+ "blur": "Размытие"
}
}
}
diff --git a/src/i18n/locales/tr/editor.json b/src/i18n/locales/tr/editor.json
index 69d7311a8..32f10b22d 100644
--- a/src/i18n/locales/tr/editor.json
+++ b/src/i18n/locales/tr/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Yakınlaştırma",
"speed": "Hız",
- "annotation": "Metin"
+ "annotation": "Açıklama",
+ "blur": "Bulanıklık"
}
}
}
diff --git a/src/i18n/locales/vi/editor.json b/src/i18n/locales/vi/editor.json
index 49fad41ff..838599646 100644
--- a/src/i18n/locales/vi/editor.json
+++ b/src/i18n/locales/vi/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "Thu phóng",
"speed": "Tốc độ",
- "annotation": "Văn bản"
+ "annotation": "Văn bản",
+ "blur": "Làm mờ"
}
}
}
diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.json
index a5335e9cd..ae15accef 100644
--- a/src/i18n/locales/zh-CN/editor.json
+++ b/src/i18n/locales/zh-CN/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "缩放",
"speed": "速度",
- "annotation": "文本"
+ "annotation": "标注",
+ "blur": "模糊"
}
}
}
diff --git a/src/i18n/locales/zh-TW/editor.json b/src/i18n/locales/zh-TW/editor.json
index 724c7f5a4..26d44016c 100644
--- a/src/i18n/locales/zh-TW/editor.json
+++ b/src/i18n/locales/zh-TW/editor.json
@@ -86,7 +86,8 @@
"kinds": {
"zoom": "縮放",
"speed": "速度",
- "annotation": "文字"
+ "annotation": "文字",
+ "blur": "模糊"
}
}
}