Quick/Bulk Edit: Fix the Tag suggestions position on the Bulk Edit textarea.

Always passes the complete `position` object to the jQuery autocomplete widget.
Also checks if an autocomplete instance already exists on the Bulk Edit textarea.

Props davidbenton.
Fixes #40242.

Merges [40357] to the 4.7 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40365 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2017-04-03 21:55:50 +00:00
parent 52e1c3eff0
commit 4294392293
2 changed files with 12 additions and 1 deletions

View File

@ -115,6 +115,15 @@ inlineEditPost = {
// enable autocomplete for tags
if ( 'post' === type ) {
$( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) {
/*
* While Quick Edit clones the form each time, Bulk Edit always re-uses
* the same form. Let's check if an autocomplete instance already exists.
*/
if ( $( element ).autocomplete( 'instance' ) ) {
// jQuery equivalent of `continue` within an `each()` loop.
return;
}
$( element ).wpTagsSuggest();
} );
}

View File

@ -120,7 +120,9 @@
},
minLength: 2,
position: {
my: 'left top+2'
my: 'left top+2',
at: 'left bottom',
collision: 'none'
},
messages: {
noResults: window.uiAutocompleteL10n.noResults,