Making WordPress.org

Changeset 12497


Ignore:
Timestamp:
03/27/2023 06:53:21 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Author Notice: Ensure that it always has a <p> element.

The notices look bad without at least one wrapping block element, and when copy-pasting from other sources contentEditable isn't always perfect.

See #6880.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-notice.php

    r12492 r12497  
    6161                $( '#author-notice-texteditable' ).on( 'input change', function() {
    6262                    // Don't allow deleting the <p> tag.
    63                     if ( ! $( this ).text() ) {
    64                         $( this ).html('<p></p>')
     63                    if ( ! $( this ).children( 'p,div,ul,ol,pre,code' ).length ) {
     64                        var text = $(this).html();
     65                        $( this ).html('<p/>').find('p').html(text);
    6566                    }
    6667
Note: See TracChangeset for help on using the changeset viewer.