-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reader: Keep inline styles in post content #46720
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~163 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~533 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
This is what I get back for content:
This is what I see: |
0d906ec
to
96a65d8
Compare
@mmtr just to clarify - won't this leave all inline styles in place, not just Gutenberg ones? Can we be more selective? I think we stripped them originally because the user-defined inline styles often don't render well in Reader. |
@mmtr all of this feels like it should be handled server side in a more consistent manner rather than just in Calypso. This won't deal with any issues in the mobile apps or elsewhere if we only do it here. |
@gibrown I gave some additional background in paYKcK-KO-p2.
It would, yes. Maybe we could add a class marker to an element (
Does this refer to things like strikethrough and underline?.. |
@kwight, @gibrown I believe the @bluefuton I think there's new context here. My understanding is that the Reader posts are supposed to look exactly like the original post, and our work here is to enable more rich content and styles here to flow through. What was previously styled content that doesn't render well, we want to gradually make better. |
How about expanding on how the normalizer was already allowing certain styles through?
After poking at the code more I rescind my attempt to have this happen server side. I think I remember making that argument years ago too. Sigh...
@krymson24 this has never fully been possible. There are lots of styles someone could add to their content that would look terrible in the Reader. That is why we build our own excerpts for instance where the streams look terrible if you just take whatever the user gives you. We definitely should continue to make things better, but it is almost certainly going to break a lot of things if we completely remove any of the normalization steps. Let's improve what is there and add more tests along the way to make it easier. |
@@ -248,28 +248,17 @@ | |||
margin: auto; | |||
} | |||
|
|||
.wp-block-buttons { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these classes removed? (They aren't the correct styles, admittedly, but I feel like we still need them, without knowing a better place to put them)
No, more that any style the user adds inline (e.g. using a Custom HTML block) ends up making it to Reader with this change. The display of content in Reader has always been opinionated - we respect certain structural basics of the layout (like tables, headings, and so on) but we make the decisions about text size, font, colour, which images or video to highlight, spacing, etc. If we're changing that, it's a big change, and we should talk through the ramifications of it with Design. |
Ah, I see – I didn't realize myself how opinionated it was. The goal of our block rendering project is to have blocks render in the Reader in a sensible, predictable way, but we certainly don't want to just regress any intentional design done up to now. It sounds like being more detailed in the post normalization handling will be a better way forward, so I'll close this for now and we can pick up elsewhere with a new approach. |
Fixes #44992.
Helps with #43595.
Changes proposed in this Pull Request
The reader API endpoints return posts with content that might include inline styles provided by the Gutenberg blocks fallbacks plugin (D50508-code). However, Calypso was stripping out those styles as part of a normalization process. This PR removes the piece of logic that was removing the inline styles so they are kept in the post content rendered in the reader.
Testing instructions
define( 'BLOCK_FALLBACKS_DEBUG', true );
to your/wp-content/mu-plugins/0-sandbox.php
file.