Skip to content

JM: Make rich-text editor previews match the published page (WYSIWYG) - #2226

Open
maebeale wants to merge 3 commits into
mainfrom
maebeale/reorder-featured-stories
Open

JM: Make rich-text editor previews match the published page (WYSIWYG)#2226
maebeale wants to merge 3 commits into
mainfrom
maebeale/reorder-featured-stories

Conversation

@maebeale

@maebeale maebeale commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 shared helper + CSS touching all rhino editors; logic is small and backward-compatible

What is the goal of this PR and why is this important?

  • The rhino rich-text editor didn't preview like the published page, so editing was guesswork. Two problems: (1) trix.css zeroed block spacing inside the editor while the published prose spaces it, and (2) rich content (event header/description) diverged further — the show page full-widths/centers images and grid cells ballooned in the editor.

How did you approach the change?

  • Block spacing: restore prose's block margins (paragraphs, lists, headings, blockquotes, figures, hr) inside .trix-content, matching @tailwindcss/typography defaults, so editor spacing matches the published page for all rhino fields.
  • Per-field parity: rhino_editor gains centered: / full_width_images: options that wrap the editor in the same prose classes the show page uses; the event form opts its header/description in to match events/show. Other editors are unchanged (defaults off).
  • Grid cells: keep the dashed editing outline but drop padding + inner block margins so borderless cells preview at published size instead of ballooning.
  • Verified in-browser (story + event) that editor and show pages line up.

UI Testing Checklist

  • Edit a story with paragraphs, a heading, a list, and a blockquote — editor spacing matches the published page.
  • Edit the AWBW Facilitator Training event — header/description content (centered text, full-width images, grid layout) previews like the event show page.
  • Grid cells show a dashed outline while editing but don't add extra padding/space.
  • Paragraphs inside a table stay tight.

Anything else to add?

  • Remaining editor-only chrome is intentional: dashed grid outlines and attachment filename labels.
  • Minor residual: a list immediately after a heading shows ~8px more top space in the editor than on the published page.

Copilot AI lite review requested due to automatic review settings August 16, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
maebeale requested a review from jmilljr24 August 16, 2026 22:09
@maebeale maebeale changed the title Match story editor block spacing to the published page JM: Match story editor block spacing to the published page Aug 16, 2026
The rhino-editor's bundled trix.css zeroes out block margins inside
.trix-content, so while editing, paragraphs and other blocks jammed
together with no separation — yet the published story (wrapped in Tailwind
`prose`) spaces them normally. That mismatch made the editor hard to read
and non-WYSIWYG. Restore prose's block spacing in the editor so what you
type matches what readers see.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 17, 2026 05:50
@maebeale
maebeale force-pushed the maebeale/reorder-featured-stories branch from 236e9d1 to 8ab2c71 Compare August 17, 2026 05:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jmilljr24 jmilljr24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No required, but some screenshot would be nice. I pulled this down quick and tried to find an example of what that changes but I didn't notice anything.

@maebeale

maebeale commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

@jmilljr24 Before and after, where spacing looks in Edit more like how it will look on Show.

Screenshot 2026-08-18 at 5 41 24 AM Screenshot 2026-08-18 at 5 41 36 AM

@maebeale maebeale changed the title JM: Match story editor block spacing to the published page Match story editor block spacing to the published page Aug 18, 2026
@maebeale
maebeale marked this pull request as ready for review August 18, 2026 09:53
Beyond block spacing, the editor diverged from the show page in ways that
made rich content (event header/description) look nothing like it renders:
the show page wraps rhino content in per-field prose classes the editor
didn't share (full-width + centered images), and borderless grid cells
ballooned in the editor from padding plus restored block margins.

Parameterize rhino_editor with centered/full_width_images so each form can
wrap its editor in the same prose classes its show page uses, and opt the
event header/description in to match events/show. Keep the dashed grid-cell
outline for editing structure but drop its padding and inner block spacing
so cells preview at the published size.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 18, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale changed the title Match story editor block spacing to the published page JM: Make rich-text editor previews match the published page (WYSIWYG) Aug 18, 2026
Comment thread app/views/events/_form.html.erb Outdated

<div class="form-group <%= 'has-error' if f.object.errors[:rhino_header].present? %>">
<%= rhino_editor(f, :header, label: "Header content") %>
<%= rhino_editor(f, :header, label: "Header content", centered: true, full_width_images: true) %>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know there isn't really any risk with this because it's just the editor but I don't love the idea of setting different styling for editors in different places. This is making the assumption that every Event will have the header section as a full width image.

I understand the slight discrepancy from the editor to the view, but every editor on the entire internet displays things differently from edit to show.

Review feedback: the rhino_editor `centered:`/`full_width_images:` options
set different styling per form and baked in the assumption that every event
header is a full-width, centered image. Centering already comes from the
content's own inline `text-align` (the toolbar writes it), so it renders the
same in edit and show without the frame forcing it — the option was redundant.
Drop both options and the per-form calls; keep the universal block-spacing and
dashed-cell tweaks, which aren't per-form.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants