Opened 3 months ago

Last modified 3 months ago

#23476 new defect (bug)

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

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

Description

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;
    else
      o.content = switchEditors.pre_wpautop(o.content);
  }
});

Attachments (1)

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

Download all attachments as: .zip

Change History (2)

leedo3 months ago

copy Text editor contents even if wpautop is disabled

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.