From fdd088b4bf5a28d88f40d0b6b6adc1a68a5922ab Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Sun, 12 Jul 2026 13:46:48 -0700 Subject: [PATCH] fix(builder): VideoBlock parses more YouTube/Vimeo URL shapes (D4) Extend detectVideoType to handle youtube.com/shorts/ID, youtube.com/live/ID, youtube.com/watch?...&v=ID (v not the first query param), and Vimeo private-hash URLs (vimeo.com/ID/HASH -> ?h=HASH player param). Existing shapes (youtu.be/ID, youtube.com/embed/ID, youtube.com/watch?v=ID, vimeo.com/ID, direct files) keep working. The emitted embed src still passes through safeUrl unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../media/VideoBlock.toHtml.test.ts | 61 +++++++++++++++++++ craft/src/components/media/VideoBlock.tsx | 39 +++++++++--- 2 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 craft/src/components/media/VideoBlock.toHtml.test.ts diff --git a/craft/src/components/media/VideoBlock.toHtml.test.ts b/craft/src/components/media/VideoBlock.toHtml.test.ts new file mode 100644 index 0000000..5158a46 --- /dev/null +++ b/craft/src/components/media/VideoBlock.toHtml.test.ts @@ -0,0 +1,61 @@ +import { describe, test, expect } from 'vitest'; +import { VideoBlock } from './VideoBlock'; + +const toHtml = (VideoBlock as any).toHtml; + +function embedSrc(videoUrl: string): string { + const { html } = toHtml({ videoUrl }, ''); + const m = html.match(/