Fix adding similar tags

git-svn-id: https://develop.svn.wordpress.org/trunk@9542 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2008-11-06 02:54:35 +00:00
parent d88ff155c1
commit cf9e769f9d
2 changed files with 5 additions and 3 deletions

View File

@ -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, '' );

View File

@ -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')),