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.

git-svn-id: https://develop.svn.wordpress.org/trunk@27366 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-03-03 01:14:27 +00:00
parent a05f04683e
commit e1028cfc7b
1 changed files with 9 additions and 5 deletions

View File

@ -91,7 +91,7 @@ final class _WP_Editors {
$editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
$switch_class = 'html-active';
$toolbar = $buttons = '';
$toolbar = $buttons = $autocomplete = '';
if ( ! empty( $set['editor_height'] ) )
$height = ' style="height: ' . $set['editor_height'] . 'px"';
@ -103,8 +103,10 @@ final class _WP_Editors {
if ( ! self::$this_quicktags && self::$this_tinymce ) {
$switch_class = 'tmce-active';
$autocomplete = ' autocomplete="off"';
} elseif ( self::$this_quicktags && self::$this_tinymce ) {
$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
$autocomplete = ' autocomplete="off"';
// 'html' is used for the "Text" editor tab.
if ( 'html' === $default_editor ) {
@ -147,7 +149,9 @@ final class _WP_Editors {
echo "</div>\n";
}
$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>');
$the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
'id="' . $editor_id . '">%s</textarea></div>' );
$content = apply_filters( 'the_editor_content', $content );
printf( $the_editor, $content );