Kotoba.Embeds (Kotoba v0.8.0)

Copy Markdown View Source

The LiveComponent behind Kotoba.Components.kotoba_embeds/1: the live content of an editor's embeds (Kotoba.Nodes.Embed).

Render it with kotoba_embeds/1, not with this module. An editor with embeds tells it, with "kotoba:embeds" events, when an embed's slot comes and goes ("mount" with the slot's id and the embed's kind, ref and title; "unmount"), and when a person asks to insert one ("picker"), and asks what a pasted or dropped URL is ("resolve", answered with the embed or nil). The component renders the app's :embed slot for each embed, and LiveView teleports it into the embed's slot in the document (a portal), so that the content is the LiveView's own: its events, its LiveComponents (a canvas, a grid) and its updates, in the document.

It also keeps which embed is full screen: the content then goes, as it is, into a layer over the page, and back.

See the Embeds guide.