Everything a LiveView needs to let people WRITE mentions and act on them:
use PhoenixKit.Mentions.LiveThat injects the typeahead's search handler and the access-request
events. In the template, swap a textarea for <.mention_input> and drop
the dialog somewhere:
<.mention_input field={@form[:description]} label="Description" />
<.access_request_dialog request={@pk_access_request} />Reading mentions needs none of this — <.mention_text> is a plain
function component. This module is only for the two INTERACTIVE halves,
which is why it is opt-in per LiveView rather than global.
Injected clauses follow the MediaBrowser embed precedent: a host adds one
use instead of copying four handlers and getting one subtly wrong.
Every one of them degrades rather than crashes — a click with no dialog
rendered, or a search with the feature switched off, is a no-op.
Summary
Functions
The "ask for access" dialog. Renders nothing until a redacted mention is clicked.
A textarea that offers @ and # as you type.
Functions
The "ask for access" dialog. Renders nothing until a redacted mention is clicked.
Deliberately says nothing about WHAT is being requested beyond its kind — the whole point of the redaction is that the reader does not learn the title, and a dialog headed with it would undo that in the one place they are most likely to read.
Attributes
request(:any) - Defaults tonil.
A textarea that offers @ and # as you type.
Identical to a plain textarea in every other way, and identical to one entirely when JavaScript is off — the hook is the only difference, and what it inserts is text the field could have held anyway. That is the whole reason the token format is what it is.
Attributes
field(Phoenix.HTML.FormField) - Defaults tonil.label(:string) - Defaults tonil.id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:string) - Defaults tonil.rows(:integer) - Defaults to4.class(:any) - Defaults tonil.placeholder(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["required", "maxlength", "phx-debounce"].