Make WordPress Core


Ignore:
Timestamp:
06/21/2015 10:00:42 PM (10 years ago)
Author:
azaozz
Message:

Update the TinyMCE initialization:

  • Replace wp_htmledit_pre() and wp_richedit_pre() with format_for_editor().
  • Replace the 'htmledit_pre' and 'richedit_pre' filters with 'format_for_editor'.
  • Do not run the post content through wpautop() in PHP when the visual editor is default. Run the textarea content through the JS wpautop on initializing TinyMCE.
  • Simplify both editors initialization.
  • Improve setting of wpActiveEditor in Quicktags.
  • Improve editor.js, use tinymce.$ when possible.

See #32425.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r32116 r32899  
    34923492    return false;
    34933493}
     3494
     3495/**
     3496 * Formats text for the rich text editor.
     3497 *
     3498 * The filter 'richedit_pre' is applied here. If $text is empty the filter will
     3499 * be applied to an empty string.
     3500 *
     3501 * @since 2.0.0
     3502 * @deprecated 4.3.0
     3503 *
     3504 * @param string $text The text to be formatted.
     3505 * @return string The formatted text after filter is applied.
     3506 */
     3507function wp_richedit_pre($text) {
     3508    _deprecated_function( __FUNCTION__, '4.3', 'format_for_editor()' );
     3509
     3510    if ( empty( $text ) ) {
     3511        /**
     3512         * Filter text returned for the rich text editor.
     3513         *
     3514         * This filter is first evaluated, and the value returned, if an empty string
     3515         * is passed to wp_richedit_pre(). If an empty string is passed, it results
     3516         * in a break tag and line feed.
     3517         *
     3518         * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
     3519         * return after being formatted.
     3520         *
     3521         * @since 2.0.0
     3522         * @deprecated 4.3.0
     3523         *
     3524         * @param string $output Text for the rich text editor.
     3525         */
     3526        return apply_filters( 'richedit_pre', '' );
     3527    }
     3528
     3529    $output = convert_chars($text);
     3530    $output = wpautop($output);
     3531    $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
     3532
     3533    /** This filter is documented in wp-includes/deprecated.php */
     3534    return apply_filters( 'richedit_pre', $output );
     3535}
     3536
     3537/**
     3538 * Formats text for the HTML editor.
     3539 *
     3540 * Unless $output is empty it will pass through htmlspecialchars before the
     3541 * 'htmledit_pre' filter is applied.
     3542 *
     3543 * @since 2.5.0
     3544 * @deprecated 4.3.0
     3545 *
     3546 * @param string $output The text to be formatted.
     3547 * @return string Formatted text after filter applied.
     3548 */
     3549function wp_htmledit_pre($output) {
     3550    _deprecated_function( __FUNCTION__, '4.3', 'format_for_editor()' );
     3551
     3552    if ( !empty($output) )
     3553        $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
     3554
     3555    /**
     3556     * Filter the text before it is formatted for the HTML editor.
     3557     *
     3558     * @since 2.5.0
     3559     * @deprecated 4.3.0
     3560     *
     3561     * @param string $output The HTML-formatted text.
     3562     */
     3563    return apply_filters( 'htmledit_pre', $output );
     3564}
     3565
Note: See TracChangeset for help on using the changeset viewer.