From e1028cfc7bb01a7133c11d945232a2acc2e113a8 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 3 Mar 2014 01:14:27 +0000 Subject: [PATCH] Editor: when TinyMCE is used, add `autocomplete="off"` to the textarea to prevent problems with missing

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 --- src/wp-includes/class-wp-editor.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index 29796be60b..b02b1ad1f7 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -87,11 +87,11 @@ final class _WP_Editors { */ public static function editor( $content, $editor_id, $settings = array() ) { - $set = self::parse_settings($editor_id, $settings); + $set = self::parse_settings( $editor_id, $settings ); $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,10 +149,12 @@ final class _WP_Editors { echo "\n"; } - $the_editor = apply_filters('the_editor', '

%s
'); - $content = apply_filters('the_editor_content', $content); + $the_editor = apply_filters( 'the_editor', '
' . + '%s
' ); + $content = apply_filters( 'the_editor_content', $content ); - printf($the_editor, $content); + printf( $the_editor, $content ); echo "\n\n\n"; self::editor_settings($editor_id, $set);