WordPress.org

Make WordPress Core

Changeset 31878


Ignore:
Timestamp:
03/25/2015 01:17:04 AM (6 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r31727 r31878  
    395395    // Remove spaces from empty paragraphs.
    396396    editor.on( 'BeforeSetContent', function( event ) {
     397        var paragraph = tinymce.Env.webkit ? '<p><br /></p>' : '<p></p>';
     398
    397399        if ( event.content ) {
    398             event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' );
     400            event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF|\s)+<\/p>/gi, paragraph );
    399401        }
    400402    });
Note: See TracChangeset for help on using the changeset viewer.