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.

Built from https://develop.svn.wordpress.org/trunk@27366


git-svn-id: http://core.svn.wordpress.org/trunk@27216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-03-03 01:15:13 +00:00
parent af8c5df4d0
commit bc7ea33113
1 changed files with 9 additions and 5 deletions

View File

@ -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 "</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>');
$content = apply_filters('the_editor_content', $content);
$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);
printf( $the_editor, $content );
echo "\n</div>\n\n";
self::editor_settings($editor_id, $set);