Closed lkraav closed 6 years ago
@norewp next step here is to test my two bug scenarios w/ the freshly released 1.9.0.
Tested on 1.9.0, situation is exactly the same.
Making a note to test this behavior in #4005 if we move in the direction of client-side wpautop . Seems this is where things are likely breaking down. Alternatively the selective wpautop
which is currently implemented server-side ought to be trimming whitespace between blocks:
Perhaps a better alternative would be to turn wpautop off when editing Gutenberg posts in the classic editor. Leaving the <p>
tags intact works quite nicely there.
Perhaps a better alternative would be to turn wpautop off when editing Gutenberg posts in the classic editor. Leaving the
<p>
tags intact works quite nicely there.
This exists already:
See: #2708
But we still conversely need to turn wpautop on selectively for legacy posts when loading the Gutenberg editor.
The root cause here appears to be in TinyMCE's content serializer during content initialization, which converts the comment demarcation sequence to a new paragraph node:
Off the top of my head, a couple ideas:
raw
for the initialization, the serializer would not be applied. We could apply this exclusively to block'd content.
html
formatcc @spocke
Confirmed, also made a fiddle: http://fiddle.tinymce.com/0hgaab/9
Imho both comments and following line breaks should be ignored when forcing root blocks in TinyMCE. There shouldn't be difference between:
<!-- comment -->
<p>a</p>
<!-- comment -->
<!-- comment -->
<p>b</p>
<!-- comment -->
<!-- comment -->
<p>c</p>
<!-- comment -->
and
<!-- comment -->
<p>a</p>
<!-- comment --><!-- comment -->
<p>b</p>
<!-- comment --><!-- comment -->
<p>c</p>
<!-- comment -->
Tested broken on 2.2.0.
EDIT Tested broken 2.3.0.
Closing in favor of https://github.com/WordPress/gutenberg/issues/6385#issuecomment-394719216, which has a proposed solution.
Just to follow up here for at least my own records, 3.1.1 shows improvement.
<p> </p>
litter is gone. Unfortunately, shortcodes still become broken (wrapped in <p>
tags).
<!-- wp:core/heading -->
<h2>Shinier than yours, meatbag.</h2>
<!-- /wp:core/heading -->
<p> </p>
<!-- wp:core/paragraph -->
<p>You can crush me but you can't crush my spirit! Is today's hectic lifestyle making you tense and impatient? It's a T. It goes "tuh". I'll tell them you went down prying the wedding ring off his cold, dead finger.</p>
<!-- /wp:core/paragraph -->
<p> </p>
<!-- wp:core/shortcode -->
<p>[column grid="2" span="1"]</p>
<!-- /wp:core/shortcode -->
<p> </p>
<!-- wp:core/paragraph -->
<p>I daresay that Fry has discovered the smelliest object in the known universe! For the last time, I don't like lilacs! Your 'first' wife was the one who liked lilacs! No argument here. A true inspiration for the children.</p>
<!-- /wp:core/paragraph -->
<p> </p>
<!-- wp:core/shortcode -->
<p>[/column]</p>
<!-- /wp:core/shortcode -->
<p> </p>
<!-- wp:core/shortcode -->
<p>[column grid="2" span="1"]</p>
<!-- /wp:core/shortcode -->
<p> </p>
<!-- wp:core/paragraph -->
<p>Hello world.</p>
<!-- /wp:core/paragraph -->
<p> </p>
<!-- wp:core/shortcode -->
<p>[/column]</p>
<!-- /wp:core/shortcode -->
<!-- wp:core/heading -->
<h2>Shinier than yours, meatbag.</h2>
<!-- /wp:core/heading -->
<!-- wp:core/paragraph -->
<p>You can crush me but you can't crush my spirit! Is today's hectic lifestyle making you tense and impatient? It's a T. It goes "tuh". I'll tell them you went down prying the wedding ring off his cold, dead finger.</p>
<!-- /wp:core/paragraph -->
<!-- wp:core/shortcode -->
<p>[column grid="2" span="1"]</p>
<!-- /wp:core/shortcode -->
<!-- wp:core/paragraph -->
<p>I daresay that Fry has discovered the smelliest object in the known universe! For the last time, I don't like lilacs! Your 'first' wife was the one who liked lilacs! No argument here. A true inspiration for the children.</p>
<!-- /wp:core/paragraph -->
<!-- wp:core/shortcode -->
<p>[/column]</p>
<!-- /wp:core/shortcode -->
<!-- wp:core/shortcode -->
<p>[column grid="2" span="1"]</p>
<!-- /wp:core/shortcode -->
<!-- wp:core/paragraph -->
<p>Hello world.</p>
<!-- /wp:core/paragraph -->
<!-- wp:core/shortcode -->
<p>[/column]</p>
<!-- /wp:core/shortcode -->
Unfortunately, shortcodes still become broken (wrapped in
<p>
tags).
Yes, this is tracked with #4456
(EDIT still broken in 2.3.0) (EDIT 2018-07-04 improved in 3.1.1, shortcodes still broken) (EDIT 2018-07-21 ^^^^ 3.3.0)
Issue Overview
Classic "Visual" editor litters Gutenberg markup w/ superfluous
<p>
tags. This is an issue where occasionally the user might have to revert to using the classic editor, due to Gutenberg metabox rendering JS crashing for whatever reason. Even if the user doesn't touch the content block at all, just loading Gutenberg markup in classic Visual editor will cause it to break on Update.I do not have Classic Editor plugin activated. Unless this is officially going to be a "run Gutenberg" requirement, I probably shouldn't have to activate it, right?
Steps to Reproduce (for bugs)
Expected Behavior
Gutenberg markup stays intact
Current Behavior
Littered markup result - shortcodes are wrapped into
<p>
tags, all block marker comments empty lines get replaced w/<p> </p>
:Possible Solution
Not sure which component is the responsible party - core or Gutenberg - could use pointers.
Screenshots / Video
Related Issues and/or PRs
Maybe #3900? Not sure, could use pointers.