diff --git a/lib/postland_web/components/core_components.ex b/lib/postland_web/components/core_components.ex
index bdea082..122ed25 100644
--- a/lib/postland_web/components/core_components.ex
+++ b/lib/postland_web/components/core_components.ex
@@ -145,14 +145,10 @@ defmodule PostlandWeb.CoreComponents do
>
- <.input
- type="textarea"
- placeholder="alt text"
- name={@attachment["url"]}
- phx-change="change_alt_text"
- phx-value-url={@attachment["url"]}
- value={@attachment["name"]}
- />
+ <.form phx-change="change_alt_text">
+ <.input type="textarea" name="alt" placeholder="alt text" value={@attachment["name"]} />
+ <.input type="hidden" name="url" value={@attachment["url"]} />
+
-
- <.post_card post={post} post_dom_id={id} />
+
+ <.post_form post_content={@post} attachments={@attachments} upload={@uploads.files} />
+
+
+ <.post_card post={post} post_dom_id={id} />
+
"""
@@ -77,7 +79,17 @@ defmodule PostlandWeb.TimelineLive do
end
def handle_event("change_alt_text", %{"alt" => value, "url" => url}, socket) do
- {:noreply, socket}
+ attachments =
+ socket.assigns.attachments
+ |> Enum.map(fn
+ %{"url" => ^url} = attachment ->
+ Map.put(attachment, "name", value)
+
+ other ->
+ other
+ end)
+
+ {:noreply, assign(socket, attachments: attachments)}
end
def handle_progress(:files, entry, socket) do