Open DylanGriffith opened 7 years ago
We were able to workaround our issue by always adding a newline to the front of the trimmed text field before saving like so:
def changeset(struct, params \\ %{}) do
params =
params
|> workaround_broken_markdown_in_exadmin("article")
struct
|> cast(params, [:article])
|> validate_required([:article])
end
# https://github.com/smpallen99/ex_admin/issues/274
# A leading newline seems to workaround the issue
defp workaround_broken_markdown_in_exadmin(params, field) do
Map.update(params, field, "", &("\n" <> String.trim(&1)))
end
For people that are looking for a fix, I patched xain in the following repo: https://github.com/jfrolich/xain/tree/shortcut-bug-fix
just add this to your mix.exs
{:xain, github: "jfrolich/xain", branch: "shortcut-bug-fix", override: true},
We're trying to build a markdown editing field and when we add a heading using
#
the text area appears empty after saving then going back to edit it.We've noticed that there is no explicit documentation for text areas (ie
input :field_name, type: :text
). Is this supported?Everything else seems to work just fine, we get a textarea and can pass through a
rows
attribute but editing is empty when there is a hash at the start of the first line.Note that the hash does not cause this issue if there is anything other than whitespace before it.
Reproduction Steps
textarea
is now empty/cc @joshprice