WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 5 months ago

#41049 closed defect (bug) (maybelater)

Visual editor adds extra space to top of the post

Reported by: programmin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: TinyMCE Keywords:
Focuses: ui, javascript Cc:
PR Number:

Description

When you have some html in the text mode, it saves and shows correctly:

	<div class="a">
	<div class="b">
<div>hello</div>
</div>



</div>

However, when you switch from visual to text again, it adds an empty (nbsp) line above the content. Even if you make no change to the visual editor (which shows by default), then go to text tab, it changes the content text!

Change History (2)

#1 @programmin
2 years ago

A similar, new bug in WP4.8 regarding how the text widget now breaks styles - probably also because visual mode loads first, as in this bug. https://www.zigpress.com/2017/06/14/the-wordpress-4-8-text-widget-will-destroy-your-content/

#2 @azaozz
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

The empty <p> in the above example seems inserted by TinyMCE when autop is disabled. Happens only when the content starts with a tab character (U+0009). If it is spaces, or is there is an empty line above it, it doesn't add the paragraph.

If autop is enabled (the default), it trims the content removing that tab char. Ideally this should be fixed upstream. When that is done, it will be fixed in WP on the next TinyMCE update.

This is also superseded by the block editor, doesn't happen there. Closing as maybelater for now. Feel free to reopen with a patch if this needs fixing in the classic editor.

Note: See TracTickets for help on using tickets.