Issue #3591910: DefaultImagePreview renders the video src in an img tag instead of the poster
DefaultImagePreview rendered <img src> from the default value's src for every media prop. For props shaped by json-schema-definitions://canvas.module/video, src is the video file URL, so the sidebar thumbnail was broken. The component now detects video-shaped props through the dereferenced prop schema (properties.src.contentMediaType is video/*) and previews the poster image. poster is optional, so the <img> only renders when a URL exists; the label and "Remove default" button still render without one.
Closes #3591910.
Testing instructions
- Apply the
core/recipes/local_video_media_typerecipe. - Create a code component with a video prop and a widescreen example poster, or place the
Code Videotest fixture component (canvas_test_e2e_code_components). - Place the component. The media widget's "Default" thumbnail shows the poster image instead of a broken image icon.
-
npm run --workspace=@drupal-canvas/ui test -- DefaultImagePreviewpasses. -
npx playwright test tests/src/Playwright/tests/isolatedPerTest/video.spec.tspasses.