Skip to content

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

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

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

Conversation

@maebeale

@maebeale maebeale commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 1 Skim 👀 CSS-only; no Ruby, JS, or markup changes

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

  • The rhino editor didn't preview like the published page, so editing was guesswork.
  • Published rich text renders inside prose (app/views/layouts/action_text/contents/_content.html.erb). The editor sits in the same prose wrapper, but trix.css's blanket .trix-content * reset zeroes every margin and padding — so the editor showed collapsed blocks, unindented lists, and oversized tables.

How did you approach the change?

  • Restate, scoped to custom-rhino-editor .trix-content, every value the reset strips: paragraph/list margins, list indent and item spacing, blockquote, h1h4, figure, hr, table font-size + cell padding, and the grid cell's own p-3.
  • Values mirror @tailwindcss/typography's em defaults, so the two stay in step.
  • Higher specificity than .trix-content * is required, hence the repetition rather than leaning on prose.
  • Drop the old editor-only table padding and zeroed cell margins — the published page gives paragraphs inside a cell full prose margins.
  • Restate h1's font-size: trix.css shrinks it to 1.2em, which would halve the em-based margin below it.

UI Testing Checklist

  • Story body: paragraphs, heading, list, blockquote — editor spacing matches the published story.
  • Event header/description: images and grid cells preview at published size.
  • Table in a story: cell padding and paragraph spacing match the published page.
  • Grid cells still show the dashed editing outline, with published padding.

Anything else to add?

  • Scope note: earlier centered: / full_width_images: options on rhino_editor were dropped — centering already comes from the content's own inline text-align, so no per-form styling is needed. This PR is now CSS-only.
  • Editor-only chrome that stays on purpose: dashed grid outlines, table cell borders, attachment filename labels.

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.

maebeale and others added 2 commits August 18, 2026 11:16
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>
The first pass only covered a handful of block margins, so lists, tables
and grid cells still previewed at sizes the published page never renders.
trix.css's blanket `.trix-content *` reset outranks the `prose` wrapper
the editor already sits in, so every value prose supplies has to be
restated at that weight: list indents and item spacing, blockquote,
h1-h4, figure, hr, prose's table font-size and cell padding, and the
grid cell's own `p-3`.

Drop the editor-only table padding and zeroed cell margins for the same
reason — the published page gives paragraphs inside a cell full prose
margins, so zeroing them here made the editor the odd one out.

Co-Authored-By: Claude Opus 5 (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