WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#28772 closed defect (bug) (fixed)

Clear formatting button and <!-- more --> tag

Reported by: korobochkin Owned by: azaozz
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords: needs-patch
Focuses: ui, javascript Cc:

Description

I made a small video showing the problem.

http://www.youtube.com/watch?v=_HeUrV-7H9U

Reproduce the bug.

  1. Paste into Text TinyMCE tab following text:
    Some text before more tag. More tag is next.
    
    <!--more-->
    
    Text placed after more tag.
    
  2. Switch to Visual tab.
  3. Select all text — cmd + a (ctrl + a).
  4. Press "Clear formatting" button.
  5. Switch to Text tab and you see:
    Some text before more tag. Wordpress running without any plugins or dirty themes :)
    
    <img title="Read More..." src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="" data-wp-more="" data-mce-resize="false" data-mce-placeholder="1" />
    
    Text placed after more tag.
    

Attachments (1)

28772.patch (1.1 KB) - added by iseulde 5 years ago.

Download all attachments as: .zip

Change History (9)

#1 @iseulde
5 years ago

  • Focuses administration removed
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.0
  • Version changed from 3.9.1 to 3.9

Thank you for finding this! :) This is actually a problem with wpviews as well (e.g. a gallery preview). It looks like all classes are removed and the styling becomes a mess. They do still convert when switching to text mode though.

#2 @iseulde
5 years ago

  • Keywords has-patch added; needs-patch removed

I'm not sure if this can be fixed some other way, but overwriting the TinyMCE defaults for "remove format" works. This is just a copy of the defaults, but it doesn't remove the class for '*', except for the rules above. So it won't remove the class for img and div.

@iseulde
5 years ago

#3 @iseulde
5 years ago

So @azaozz suggested moving everything to data-wp- instead of using a class. That's probably the way to go. :)

#4 @korobochkin
5 years ago

Hm... You are so smart and fast, @avryl! I am not very well versed in Javascript :)

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.


5 years ago

#6 @DrewAPicture
5 years ago

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

@azaozz: Can you please review the patch?

#7 @iseulde
5 years ago

  • Keywords needs-patch added; has-patch removed

#8 @azaozz
5 years ago

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

In 29317:

TinyMCE:

  • Use data-wp-* for processing and styling of the more and nextpage placeholders, keep the class names for back-compat. Makes them "immune" to "Clear formatting".
  • Translate the titles of the placeholders.

Fixes #28772.

Note: See TracTickets for help on using tickets.