mirror of
https://github.com/TriliumNext/Trilium.git
synced 2026-10-12 02:09:59 +00:00
A clipped page's YouTube players reached the server as <iframe>s, which the sanitizer strips because `iframe` is not an allowed tag, so the videos vanished from the note without a trace. (Before iframes were stripped, they were stored as live players and all started playing when the note opened, which is what the issue first reported.) `processContent()` now replaces each iframe whose `src` is a YouTube video with the `section.link-embed` markup the text editor stores for a YouTube link preview: a thumbnail that loads the player only on click. Its title, channel, thumbnail and favicon come from the same oEmbed lookup the editor uses, exported from core as `resolveYouTubePreview()`, and the pictures are stored as attachments of the clipped note. When the lookup fails, the preview keeps only the URL rather than dropping the video. Other iframes are still removed by the sanitizer. The conversion runs on the server rather than in the extension because the server knows it can render link previews (added in v0.104.0): an older server keeps stripping the iframe, and an older extension gets the fix without an update. `YOUTUBE_REGEX` also matches `youtube-nocookie.com/embed/`, the domain of YouTube's privacy-enhanced embeds. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>