View Source Philtre.Block behaviour (philtre v0.12.1)
Defines what the structure of a block should be
Link to this section Summary
Callbacks
Returns a list of base cells contained within the block
Takes the struct for the specific block type and returns its data serialized as a json-encodeable map with string keys.
Takes the struct for the specific block type and returns its id
Takes in the block id and the serialized data and returns the struct for the block.
Used to simplify and cleanup the block, remove blank fields, etc.
Renderer for the live, interactive version of the block, when editing
Renderer for the static, read-only version of the block, when rendering as plain html
Used to set a selection (focus cursor) on the block
Used to transform the contenteditable block into the current block
Takes the struct for the specific block type and returns its string type
Link to this section Callbacks
@callback cells(struct()) :: [Philtre.Block.ContentEditable.Cell.t()]
Returns a list of base cells contained within the block
Takes the struct for the specific block type and returns its data serialized as a json-encodeable map with string keys.
Takes the struct for the specific block type and returns its id
Takes in the block id and the serialized data and returns the struct for the block.
Used to simplify and cleanup the block, remove blank fields, etc.
@callback render_live(%{block: struct()}) :: Phoenix.LiveView.Rendered.t()
Renderer for the live, interactive version of the block, when editing
@callback render_static(%{block: struct()}) :: Phoenix.LiveView.Rendered.t()
Renderer for the static, read-only version of the block, when rendering as plain html
@callback set_selection( struct(), Philtre.Block.ContentEditable.Selection.t() ) :: struct()
Used to set a selection (focus cursor) on the block
@callback transform(Philtre.Block.ContentEditable.t()) :: struct()
Used to transform the contenteditable block into the current block
Takes the struct for the specific block type and returns its string type