newlines for preview
This commit is contained in:
@@ -45,7 +45,10 @@ defmodule LabelmakerWeb.Home do
|
|||||||
]}
|
]}
|
||||||
style={"height: calc(2rem + #{@preview_height}px); color: #{@color}; font-family: #{@font}; font-size: #{@size}px; line-height: #{@size}px;"}
|
style={"height: calc(2rem + #{@preview_height}px); color: #{@color}; font-family: #{@font}; font-size: #{@size}px; line-height: #{@size}px;"}
|
||||||
>
|
>
|
||||||
{Enum.join(@preview_text, "<br />")}
|
<%= for {str, i} <- Enum.with_index(@preview_text) do %>
|
||||||
|
{str}
|
||||||
|
{if i < length(@preview_text) - 1, do: raw("<br />")}
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form phx-change="update_label" phx-submit="make_label" class="space-y-4">
|
<form phx-change="update_label" phx-submit="make_label" class="space-y-4">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ defmodule LabelmakerWeb.Tools do
|
|||||||
|> Map.new(fn {k, v} -> {String.to_atom(k), v} end)
|
|> Map.new(fn {k, v} -> {String.to_atom(k), v} end)
|
||||||
|> Enum.map(fn
|
|> Enum.map(fn
|
||||||
{:preview_height, _} -> {:preview_height, size + size * line_breaks}
|
{:preview_height, _} -> {:preview_height, size + size * line_breaks}
|
||||||
{:preview_text, _} -> {:preview_text, String.split(label, "\n")}
|
{:preview_text, _} -> {:preview_text, String.split(label, "\\n")}
|
||||||
pair -> pair
|
pair -> pair
|
||||||
end)
|
end)
|
||||||
|> Enum.filter(fn
|
|> Enum.filter(fn
|
||||||
|
|||||||
Reference in New Issue
Block a user