Make WordPress Core

Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#23476 closed defect (bug) (duplicate)

disabling wpautop in TinyMCE settings leads to strange behavior in Text editor

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


If I disable the wpautop behavior in TinyMCE with a tiny_mce_before_init filter like so:

function ars_disable_tinymce_wpautop($in) {
  $in['wpautop'] = false;
  $in['remove_linebreaks'] = false;
  $in['apply_source_formatting'] = true;
  return $in;

The text view of the editor exhibits some odd behavior when saving. Instead of submitting the current state of the text editor, the text editor is updated with the contents of the HTML view, and then saved.

However, if I click over to the Visual editor before saving it will save correctly. I believe this logic in the wordpress TinyMCE plugin may be the cause:

ed.onSaveContent.add(function(ed, o) {
  if ( ed.getParam('wpautop', true) && typeof(switchEditors) == 'object' ) {
    if ( ed.isHidden() )
      o.content = o.element.value;
      o.content = switchEditors.pre_wpautop(o.content);

Attachments (1)

tinymce_wpautop_save.patch (854 bytes) - added by leedo 9 years ago.
copy Text editor contents even if wpautop is disabled

Download all attachments as: .zip

Change History (3)

9 years ago

copy Text editor contents even if wpautop is disabled

#1 @SergeyBiryukov
9 years ago

  • Keywords has-patch added

#2 @azaozz
7 years ago

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

This is pretty much a duplicate of #23743 that we failed to find at the time, fixed in [23745].

Last edited 7 years ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.