Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Add supports for Phoenix.Ecto changeset errors #35

Description

@Matsa59

Imagine we add a mark that doesn't exist, an invalid changeset will be returned.

We have to transform thoses changeset to inline it and allow user to display error using

<%= error_tag f, :field %>

Example of invalid changeset

#Ecto.Changeset<
  action: nil,
  changes: %{
    title: #Ecto.Changeset<
      action: :insert,
      changes: %{
        content: #Ecto.Changeset<
          action: :insert,
          changes: %{
            content: [
              #Ecto.Changeset<
                action: :insert,
                changes: %{
                  content: [
                    #Ecto.Changeset<
                      action: :insert,
                      changes: %{text: "Hello world"},
                      errors: [marks: {"is invalid", []}],
                      data: #ExProsemirror.Block.Text<>,
                      valid?: false
                    >
                  ]
                },
                errors: [],
                data: #ExProsemirror.Block.Paragraph<>,
                valid?: false
              >
            ]
          },
          errors: [],
          data: #ExProsemirror.Block.Doc<>,
          valid?: false
        >
      },
      errors: [],
      data: #ExProsemirror.Schema<>,
      valid?: false
    >,
    title_plain: "{\"type\":\"doc\",\"content\":[{\"type\":\"p\",\"content\":[{\"type\":\"text\",\"marks\":[{\"type\":\"em\"},{\"type\":\"strong\"},{\"type\":\"underline\"}],\"text\":\"Hello world\"}]}]}"
  },
  errors: [],
  data: #ExProsemirrorSample.Article<>,
  valid?: false
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions