Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#46861 closed defect (bug) (reported-upstream)

Block Editor: Classic block missing content in Preview

Reported by: joyously's profile joyously Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Priority: normal
Severity: normal Version: 5.1
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Tracking https://github.com/WordPress/gutenberg/issues/14861 here since it appears that the problem could be in content filters.

The content is visible in the editor, but the Preview is missing some content.

To reproduce

  1. I was using the Theme Unit Test data from https://github.com/WPTRT/theme-unit-test/
  2. Click to edit the Post titled "Markup: HTML Tags and Formatting"
  3. Scroll down to see that the Table follows the Block Quote.
  4. Click on Preview.
  5. See that there is no Table heading following the Block Quote and the formatting of the rest of the page is for blockquote.

Expected behavior
The preview should match the content in the editor.

This is how it looks in the editor:

And this is how the preview looks:

Attachments (2)

1.jpg (119.2 KB) - added by SergeyBiryukov 6 years ago.
2.jpg (145.8 KB) - added by SergeyBiryukov 6 years ago.

Download all attachments as: .zip

Change History (11)

This ticket was mentioned in Slack in #forums by joyously. View the logs.


7 years ago

This ticket was mentioned in Slack in #core by joyously. View the logs.


7 years ago

#3 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 5.3

This ticket was mentioned in Slack in #core by joyously. View the logs.


6 years ago

#5 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#6 @SergeyBiryukov
6 years ago

This might be related to https://github.com/WordPress/gutenberg/issues/13655.

Could you check the value of mbstring.func_overload PHP setting on your install? phpinfo() should display it.

@SergeyBiryukov
6 years ago

@SergeyBiryukov
6 years ago

#7 @SergeyBiryukov
6 years ago

  • Description modified (diff)

#8 @SergeyBiryukov
6 years ago

I was able to reproduce the issue with the following example:

<a href="#" title="&lt;cite&gt; represents a reference to a creative work.">...</a>

It results in this output on the front end:

<a href="#" title="<cite> represents a reference to a creative work.&#8221;>&#8230;</a>

Note the closing quote converted to &#8221;, breaking any markup that follows.

With the wptexturize() filter disabled, the input works as expected.

Using the Classic Editor (in both Visual and Text mode), the output is correct even with wptexturize() enabled:

<a title="&lt;cite&gt; represents a reference to a creative work." href="#">&#8230;</a>

So this appears to be a wptexturize() issue that only manifests with the Block Editor. I think the difference is that the Block Editor does not preserve the escaped &lt;cite&gt; tag in the title attribute, converting it to <cite>, and wptexturize() is confused by that.

I guess the Block Editor should preserve &lt; and &gt; entities in HTML attributes. I've reopened the original GitHub issue and commented there.

#9 @ocean90
6 years ago

  • Milestone 5.3 deleted
  • Resolution set to reported-upstream
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.