fix: insert link/media lands at the cursor and closes the overlay instead of breaking the editor

This commit is contained in:
2026-07-17 10:58:51 +02:00
parent b016f6d812
commit b517672663
6 changed files with 181 additions and 23 deletions

View File

@@ -117,7 +117,6 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
id: socket.assigns.post_id,
content: content
})
|> assign(:shell_overlay, nil)
{:ok, socket}
end
@@ -316,18 +315,6 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
{:noreply, do_remove_list_value(socket, :categories, category)}
end
def handle_event("insert_content", %{"content" => content}, socket) do
socket =
socket
|> Phoenix.LiveView.push_event("post-editor-insert-content", %{
id: socket.assigns.post_id,
content: content
})
|> assign(:shell_overlay, nil)
{:noreply, socket}
end
def handle_event("close_quick_actions", _params, socket) do
socket =
socket
@@ -892,7 +879,7 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
end)
if map_size(attrs) == 0 do
assign(socket, :shell_overlay, nil)
socket
else
case Posts.update_post(post_id, attrs) do
{:ok, updated_post} ->
@@ -910,7 +897,6 @@ defmodule BDS.Desktop.ShellLive.PostEditor do
)
|> assign(:save_state, :dirty)
|> assign(:dirty?, true)
|> assign(:shell_overlay, nil)
|> build_data()
Notify.dirty(:post, post_id, true)