Skip to content

Commit

Permalink
Save form data when changing between visual editor and code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox committed Dec 15, 2023
1 parent b10a4d0 commit 9741cf3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/beacon/live_admin/live/page_editor_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ defmodule Beacon.LiveAdmin.PageEditorLive.FormComponent do
def update(%{site: site, page: page} = assigns, socket) do
page = Map.put_new(page, :path, "/")

changeset = Content.change_page(site, page)
changeset = case socket.assigns do
%{form: form} ->
form.source
_ ->
Content.change_page(site, page)
end
layouts = Content.list_layouts(site)

%{data: builder_page} = WebAPI.Page.show(site, page)

{:ok,
socket
|> assign(assigns)
Expand Down

0 comments on commit 9741cf3

Please sign in to comment.