Make WordPress Core

Changeset 27366


Ignore:
Timestamp:
03/03/2014 01:14:27 AM (11 years ago)
Author:
azaozz
Message:

Editor: when TinyMCE is used, add autocomplete="off" to the textarea to prevent problems with missing <p> tags when the user reloads the page or uses Go Back/Go Forward buttons, and when editing the same post from two different windows. The autocomplete can be removed with the the_editor filter. Part props xsonic, fixes #27251.

File:
1 edited

Legend:

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

    r27364 r27366  
    8888    public static function editor( $content, $editor_id, $settings = array() ) {
    8989
    90         $set = self::parse_settings($editor_id, $settings);
     90        $set = self::parse_settings( $editor_id, $settings );
    9191        $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
    9292        $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
    9393        $switch_class = 'html-active';
    94         $toolbar = $buttons = '';
     94        $toolbar = $buttons = $autocomplete = '';
    9595
    9696        if ( ! empty( $set['editor_height'] ) )
     
    104104        if ( ! self::$this_quicktags && self::$this_tinymce ) {
    105105            $switch_class = 'tmce-active';
     106            $autocomplete = ' autocomplete="off"';
    106107        } elseif ( self::$this_quicktags && self::$this_tinymce ) {
    107108            $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
     109            $autocomplete = ' autocomplete="off"';
    108110
    109111            // 'html' is used for the "Text" editor tab.
     
    148150        }
    149151
    150         $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $height . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
    151         $content = apply_filters('the_editor_content', $content);
    152 
    153         printf($the_editor, $content);
     152        $the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
     153            '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
     154            'id="' . $editor_id . '">%s</textarea></div>' );
     155        $content = apply_filters( 'the_editor_content', $content );
     156
     157        printf( $the_editor, $content );
    154158        echo "\n</div>\n\n";
    155159
Note: See TracChangeset for help on using the changeset viewer.