mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-16 04:46:46 +08:00
b3b79afed4
* Restructure hook files * Simplify app.js * Refactor hooks * Implement password toggle with JS commands
24 lines
508 B
Elixir
24 lines
508 B
Elixir
defmodule LivebookWeb.Output.MarkdownComponent do
|
|
use LivebookWeb, :live_component
|
|
|
|
@impl true
|
|
def update(assigns, socket) do
|
|
socket = assign(socket, assigns)
|
|
|
|
{:ok,
|
|
push_event(socket, "markdown_renderer:#{socket.assigns.id}:content", %{
|
|
content: socket.assigns.content
|
|
})}
|
|
end
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div class="markdown"
|
|
id={"markdown-renderer-#{@id}"}
|
|
phx-hook="MarkdownRenderer"
|
|
data-id={@id}>
|
|
</div>
|
|
"""
|
|
end
|
|
end
|