✍️ v0.27.3 — Rich Text Editor
The rich_text_area form-builder method has been a placeholder since it was introduced — it rendered a literal "Not yet implemented" paragraph. This release makes it real: a new Form::RichTextComponent wraps ActionText's Trix editor in the standard Midwest field chrome, so a rich-text field carries the same label, description, error, and disabled affordances as every other input. ActionText stays opt-in — apps that don't use it are entirely unaffected.
What's New
Midwest::Form::RichTextComponent — an ActionText editor with Midwest field chrome
A Trix editor that looks and behaves like a Midwest text field. The editor markup itself is rendered by ActionText's own helper; Midwest supplies the surrounding label / description / error structure and restyles trix-editor and trix-toolbar to match the rest of the form library. It accepts the familiar field options — label:, description:, placeholder:, error:, optional:, required:, value:, and disabled:.
A few deliberate details:
- ActionText is not a Midwest dependency. Apps opt in. If the component renders without ActionText installed, it raises a named
ActionTextMissingerror (pointing you atbin/rails action_text:install) rather than degrading into an empty editor that's hard to diagnose. - Disabled is enforced at the source. Trix has no native
disabled, sodisabled: trueturns offcontenteditable, announces the state to assistive tech, and greys the toolbar and field.
Render it through the form builder or the standalone helper:
<%= midwest_form_with model: @post do |f| %> <%= f.rich_text_area :body, label: "Body", placeholder: "Write something…" %><% end %><%= midwest_form_rich_text(name: "post[body]", label: "Body") %>What Changed
rich_text_area now renders the editor instead of a stub
Midwest's form builder previously answered rich_text_area with "<p>Not yet implemented (rich text)</p>". It now renders the new RichTextComponent, applying the same attribute assignment (assign_options) every other field uses so value and name derive from the form object automatically. A rich_textarea alias is available for callers who prefer that spelling.
New midwest_form_rich_text view helper
Form::RichTextComponent is registered in the helper map, so it can be rendered directly with midwest_form_rich_text(...) outside a form builder — the same convention as midwest_form_address and the other form helpers.
What Was Removed
The rich_text_area placeholder — the hard-coded "Not yet implemented (rich text)" markup — is gone, replaced by the real component. No component options, slots, or public helpers were dropped, and there are no breaking API changes: apps calling rich_text_area simply get a working editor now instead of placeholder text.
Dev Process
- Roadmap — Rich text was not a scoped roadmap item; like the Email Sections library before it, it lands in the v0.27 line as a net-new addition. The v0.27 milestone note is updated to record that v0.27.3 delivered the
Form::RichTextComponent. - Demo wiring — the demo app now boots the ActionText engine and pins
trix/@rails/actiontextvia importmap so the previews render a live editor. Trix's own stylesheet is deliberately left unloaded — an unlayeredtrix.csswould win over themidwest.componentscascade layer and undo Midwest's restyle. - Tests — form-builder tests cover the new
rich_text_arearendering path, and a full Lookbook preview set (default,with_label,with_value,with_description,error,disabled, and a parameterizedplayground) exercises the component. The coverage badge ticked up to 95%. - Version bumps — the gem, the
@unabridged/midwestnpm package, and the@unabridged/midwest-language-serverLSP package are all bumped to0.27.3.