From f0c178cf3165ce800118d0a7f46b3b8db87bd58d Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Thu, 19 Jan 2023 22:39:09 +0100 Subject: [PATCH] Refactor translation form_component --- lib/outlook_web/live/translation_live/form_component.ex | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/outlook_web/live/translation_live/form_component.ex b/lib/outlook_web/live/translation_live/form_component.ex index 88112af..eeb60e2 100644 --- a/lib/outlook_web/live/translation_live/form_component.ex +++ b/lib/outlook_web/live/translation_live/form_component.ex @@ -2,7 +2,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do use OutlookWeb, :live_component alias Outlook.{Translations,InternalTree} - alias Outlook.InternalTree.TranslationUnit + alias Outlook.InternalTree.{TranslationUnit,Html} @impl true def render(assigns) do @@ -195,10 +195,8 @@ defmodule OutlookWeb.TranslationLive.FormComponent do defp publish(translation_params, %{"publish" => "true"}, socket) do translation_params |> Map.put("public_content", - OutlookWeb.HtmlDocComponent.render_doc(%{tree: InternalTree.render_translation(socket.assigns.translation.article.content, - translation_params["content"]), tunit_tag: "span"}) - |> Phoenix.HTML.Safe.to_iodata() - |> IO.iodata_to_binary()) + InternalTree.render_translation(socket.assigns.translation.article.content, translation_params["content"]) + |> Html.render_doc()) end defp publish(translation_params, %{"publish" => "false"}, _) do translation_params