Putting down some additional thoughts here since this is actually a pretty complicated subject.
Adding on to my example…
I’d only want h2’s within my blog posts to have that margin, so normally I’d make sure my Post Content element inside my Single Post template has the <article> tag and use this CSS instead:
Again, that works perfectly on the front-end, but since Gutenberg is just loading the post content, <article> won’t show up in the Gutenberg HTML and thus the CSS won’t be applied in the backend.
So we actually need two sets of styling: article h2 for the front-end, and .editor-styles-wrapper h2 for the back-end.
The problem is… how do you get .editor-styles-wrapper h2 to only apply to Single Posts on the back-end?
Great food for thought here @sunny, thank you for sharing!
Those Gutenberg default styles
Not sure how heading margins on the backend were missed… Will look at providing a fix in the coming days.
We already do a few modifications on the Global Stylesheet to allow for specific rules that can’t be applied everywhere (body, html). The extra would be the Single Post conditional.
The logic is already there, so your point brings up different possibilities in my mind. We simply need to make it accessible and easy to set up, but I definitely see an area that could allow you to specify a custom selector that then applies select rules on the backend and different ones on the frontend.