Fix unexpected replacement of a previous tag when selecting a tag from autosuggest results.

props camdensegal.
fixes #28471.

git-svn-id: https://develop.svn.wordpress.org/trunk@28851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-06-26 16:07:36 +00:00
parent 2187cc6f98
commit 3513f37623
3 changed files with 6 additions and 6 deletions

View File

@ -110,7 +110,7 @@ inlineEditPost = {
if ( 'post' === type ) { if ( 'post' === type ) {
// support multi taxonomies? // support multi taxonomies?
tax = 'post_tag'; tax = 'post_tag';
$('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
} }
$('html, body').animate( { scrollTop: 0 }, 'fast' ); $('html, body').animate( { scrollTop: 0 }, 'fast' );
}, },
@ -195,7 +195,7 @@ inlineEditPost = {
textarea.val(terms); textarea.val(terms);
} }
textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
}); });
// handle the post status // handle the post status

View File

@ -240,11 +240,11 @@
if ($currentResult) { if ($currentResult) {
if ( options.multiple ) { if ( options.multiple ) {
if ( $input.val().indexOf(options.multipleSep) != -1 ) { if ( $input.val().indexOf(options.multipleSep) != -1 ) {
$currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ); $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ) + ' ';
} else { } else {
$currentVal = ""; $currentVal = "";
} }
$input.val( $currentVal + $currentResult.text() + options.multipleSep); $input.val( $currentVal + $currentResult.text() + options.multipleSep + ' ' );
$input.focus(); $input.focus();
} else { } else {
$input.val($currentResult.text()); $input.val($currentResult.text());
@ -294,7 +294,7 @@
options = options || {}; options = options || {};
options.multiple = options.multiple || false; options.multiple = options.multiple || false;
options.multipleSep = options.multipleSep || ", "; options.multipleSep = options.multipleSep || ",";
options.source = source; options.source = source;
options.delay = options.delay || 100; options.delay = options.delay || 100;
options.resultsClass = options.resultsClass || 'ac_results'; options.resultsClass = options.resultsClass || 'ac_results';

View File

@ -476,7 +476,7 @@ function wp_default_scripts( &$scripts ) {
'error' => __('Error while saving the changes.'), 'error' => __('Error while saving the changes.'),
'ntdeltitle' => __('Remove From Bulk Edit'), 'ntdeltitle' => __('Remove From Bulk Edit'),
'notitle' => __('(no title)'), 'notitle' => __('(no title)'),
'comma' => _x( ',', 'tag delimiter' ), 'comma' => trim( _x( ',', 'tag delimiter' ) ),
) ); ) );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 ); $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 );