From cf9e769f9d74f9433895444e7867f141c766aa79 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 6 Nov 2008 02:54:35 +0000 Subject: [PATCH] Fix adding similar tags git-svn-id: https://develop.svn.wordpress.org/trunk@9542 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/post.js | 6 ++++-- wp-includes/script-loader.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index 8aa3b3dcd0..3db3b512ed 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -41,12 +41,14 @@ function tag_flush_to_text(e,a) { a = a || false; var text = a ? jQuery(a).text() : jQuery('#newtag').val(); var newtags = jQuery('#tags-input').val(); - var t = text.replace( /\s*([^,]+)[\s,]*/, '$1' ); + + var t = text.replace( /\s*([^,]+).*/, '$1,' ); + newtags += ',' if ( newtags.indexOf(t) != -1 ) return false; - newtags += ',' + text; + newtags += text; // massage newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' ); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 4277eb95fe..0ad90ed9a1 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -176,7 +176,7 @@ function wp_default_scripts( &$scripts ) { 'save' => __('Save'), 'cancel' => __('Cancel'), ) ); - $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug', 'settings-box'), '20081103' ); + $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug', 'settings-box'), '20081105' ); $scripts->localize( 'post', 'postL10n', array( 'tagsUsed' => __('Tags used on this post:'), 'add' => attribute_escape(__('Add')),