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

props camdensegal.
fixes #28471.
Built from https://develop.svn.wordpress.org/trunk@28851


git-svn-id: http://core.svn.wordpress.org/trunk@28655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-06-26 16:08:14 +00:00
parent fd1c4b7fed
commit 1c227553b9
4 changed files with 7 additions and 7 deletions

View File

@ -110,7 +110,7 @@ inlineEditPost = {
if ( 'post' === type ) {
// support multi taxonomies?
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' );
},
@ -195,7 +195,7 @@ inlineEditPost = {
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

File diff suppressed because one or more lines are too long

View File

@ -240,11 +240,11 @@
if ($currentResult) {
if ( options.multiple ) {
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 {
$currentVal = "";
}
$input.val( $currentVal + $currentResult.text() + options.multipleSep);
$input.val( $currentVal + $currentResult.text() + options.multipleSep + ' ' );
$input.focus();
} else {
$input.val($currentResult.text());
@ -294,7 +294,7 @@
options = options || {};
options.multiple = options.multiple || false;
options.multipleSep = options.multipleSep || ", ";
options.multipleSep = options.multipleSep || ",";
options.source = source;
options.delay = options.delay || 100;
options.resultsClass = options.resultsClass || 'ac_results';

View File

@ -476,7 +476,7 @@ function wp_default_scripts( &$scripts ) {
'error' => __('Error while saving the changes.'),
'ntdeltitle' => __('Remove From Bulk Edit'),
'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 );