You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(import): route YouTube iframes and <video> elements to the base.video module (CoreBunch#151)
* fix(import): route YouTube iframes and <video> elements to the base.video module
YouTube <iframe> embeds and <video> elements imported via paste-HTML, Super
Import, or the AI agent's site_insert_html tool previously fell through to the
catch-all rule as base.container nodes. base.container declares no CSP sources,
so YouTube iframes stayed blocked by the published page's frame-src 'none' even
after PR CoreBunch#141 (which only fires when base.video renders).
New rules added to HTML_TO_MODULE_RULES in src/core/htmlImport/rules.ts:
- iframe: YouTube host check (youtube.com/m.youtube.com/youtube-nocookie.com/
youtu.be) maps to base.video; any other iframe falls back to base.container
with tag:'custom',customTag:'iframe' so Vimeo, Maps, and arbitrary embeds
keep working. rel=0 in the embed URL sets noRelatedVideos:true; playsinline=1
sets playsinline:true; the title attribute maps to the title prop.
- video: maps to base.video with videoUrl from <video src> or the first
<source src> child, and all boolean attributes (controls, autoplay, loop,
muted, playsinline). recurse:false so <source> children are consumed, not
emitted as extra nodes.
Inline YouTube host detection in rules.ts — src/core/ must not import from
src/modules/, so parseYoutubeId from src/modules/base/video/youtube.ts is not
imported. The importer only needs host-level detection to decide the module;
base.video's render() re-parses the stored videoUrl at publish time.
base.video (src/modules/base/video/) extended with two new props:
- title (default: 'YouTube video') — used as the iframe title attribute,
replacing the previous hardcoded string. Improves accessibility.
- noRelatedVideos (default: false) — appends rel=0 to the YouTube embed URL
to suppress recommended videos. youtubeEmbedUrl() updated to build the query
string from autoplay and noRelatedVideos together. VideoEditor.tsx wired up.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: restore docs files accidentally staged from prior branch
The chore/gitignore-superpowers branch had these files staged for deletion.
When switching to fix/import-video-embeds-to-base-video the staged index was
inherited and the previous commit swept them in unintentionally. Restore them
from origin/main to keep this PR scope clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments