Media and embeds

Images with upload, video, files, YouTube and X.

Images

The image feature appears only when the host wired onUploadImage. An image is a void element: the canvas shows it, and its settings (the file, the alternative text, the caption) are fields in the inspector. The file field crops the picked image and hands it to your callback; its result lands on the node, and a failure keeps the node and says why. Files dropped on or pasted into the canvas become image nodes too, one per file, each filled in as its upload lands; files that are not images go to the host, as Files and drop explains. The callback receives the File and resolves with { url, width?, height? }; the sizes reach the rendered <img>.

onUploadImage={async (file) => {
	const uploaded = await storage.put(file);
	return { url: uploaded.publicUrl, width: uploaded.width, height: uploaded.height };
}}

Video, files, YouTube, X

Four embed features, each an attribute form in a popover rather than a prompt: a video url, a file url and name, a YouTube url or id, an X post url or id. Leave any out with createContentFeatures({ embeds: ["youtube"] }).

A YouTube node renders the youtube-nocookie player; an X post renders the blockquote X's embed script upgrades in place, so a host that loads the script gets the card and one that does not still gets a link.

In an email

An email has no embeds: no mail client plays a video. The email preset keeps the image and gives it a link and a play overlay, so a video becomes a thumbnail that opens it. See Email: image options, and every other block of the email in Email blocks.