From 9f8d61cff9155f76c696fe6250269cc85923fddc Mon Sep 17 00:00:00 2001 From: SimonLab Date: Wed, 30 Nov 2022 22:00:14 +0000 Subject: [PATCH] Display raw html content Display the raw html content with phoenix --- lib/app_web/live/app_live.ex | 7 +++++-- lib/app_web/live/app_live.html.heex | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/app_web/live/app_live.ex b/lib/app_web/live/app_live.ex index 66340f51..1142b85d 100644 --- a/lib/app_web/live/app_live.ex +++ b/lib/app_web/live/app_live.ex @@ -38,8 +38,11 @@ defmodule AppWeb.AppLive do @impl true def handle_event("item-updated", %{"content" => content}, socket) do IO.inspect(content) - content = String.replace(content, "tag", "tag") - {:noreply, assign(socket, item: content )} + + content = + String.replace(content, "tag", "tag") + + {:noreply, assign(socket, item: content)} end @impl true diff --git a/lib/app_web/live/app_live.html.heex b/lib/app_web/live/app_live.html.heex index 37a8426a..7825ddd1 100644 --- a/lib/app_web/live/app_live.html.heex +++ b/lib/app_web/live/app_live.html.heex @@ -15,7 +15,7 @@ id="content" class="h-80 bg-gray-200 w-full my-10 text-slate-800 text-3xl max-h-100 border border-b border-slate-200" > - <%= @item %> + <%= raw @item %>