WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#31255 closed defect (bug) (fixed)

Remove space from empty paragraphs

Reported by: iseulde Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description

I remember we fixed this in #28282, but this problem popped up again. Not sure where exactly <p></p> is replaced with <p>&nbsp;</p> again. Maybe just better to add a <br>.

Attachments (1)

31255.patch (634 bytes) - added by iseulde 6 years ago.

Download all attachments as: .zip

Change History (14)

@iseulde
6 years ago

#1 @iseulde
6 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

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


6 years ago

#3 @danielbachhuber
6 years ago

Google Docs is adding this on copy and paste: https://dl.dropboxusercontent.com/s/4zu1ykpm2c40ouf/2015-02-10%20at%2010.38%20AM%202x.png?dl=0

Maybe we can expand to more HTML characters that include some empty space.

#4 @iseulde
6 years ago

@danielbachhuber Can you share a Google Doc that's causing problems so I can try to reproduce? I'm not entirely sure if this is a related problem.

#5 @iseulde
6 years ago

Thats interesting, and a TinyMCE problem it seems. Can't reproduce this in a plain contenteditable field.
The problem here is that strong tags are inserted, not that there is an empty line. You're separating paragraphs in the Google Doc with an empty line, while it might be better to add whitespace at the bottom or top of paragraphs instead (see Format => Line spacing => Add space after paragraph). So TinyMCE is correctly adding an empty line between the paragraphs. The weird thing is the strong tags being added with a space in between... I'll take a look at what might be causing it and otherwise ping spocke.

#6 @iseulde
6 years ago

@danielbachhuber Spocke (TinyMCE lead dev) is looking into it. :)

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


6 years ago

#8 @DrewAPicture
6 years ago

  • Owner set to azaozz
  • Status changed from new to reviewing

@azaozz: Mind taking a look at 31255.patch and making a recommendation for commit or punt?

@iseulde: Is there a corresponding GitHub issue or similar for the problem you reached out to Spocke about?

#9 @azaozz
6 years ago

  • Milestone changed from 4.2 to Future Release

I bet this is the same Chrome/WebKit "feature" that inserts thousands of "pesky" spans on paste :)

This time it seems to replace style="font-weight: bold" with <b> that gets converted to <strong> by TinyMCE... The fix is: don't use Chrome to copy and paste from other web pages!

It is unfortunate that there are open tickets for that unexplainable behavior both for Chromium and WebKit, but they don't get any attention :(

#10 follow-up: @iseulde
6 years ago

  • Milestone changed from Future Release to 4.2

@azaozz: The Google Docs issue is not the main issue, it was thought it was related. So moving back to 4.2.
@danielbachhuber: This should be fixed now in trunk: https://github.com/tinymce/tinymce/commit/0a8cd0a67702f17e1281b4bb513b2238fe4fdd39

#11 in reply to: ↑ 10 @azaozz
6 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

Replying to iseulde:

Hmm, I think that happens sometimes in a "plain" contenteditable div too, seen in Chrome. Depends on the differences in styles between the place the text is copied from and the contenteditable. Chrome certainly converts <b> to <span style="font-weight: bold;"> in some cases, think it can convert it the other way round too.

Testing a bit more, this seems prevented in TinyMCE as the pasted HTML is cleaned before inserting it in the editor.

In any case, can close as fixed with the update to the latest TinyMCE version, [31700].

Last edited 6 years ago by azaozz (previous) (diff)

#12 @azaozz
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Looks like the original bug wasn't fixes or was reintroduced in a newer Chrome. We still need that, but only in WebKit.

#13 @azaozz
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 31878:

TinyMCE: pad empty paragraphs with <br> in Chrome to stop it from inserting non-breaking spaces in them.
Props iseulde. Fixes #31255.

Note: See TracTickets for help on using tickets.