Make WordPress Core

Ticket #19392: 19392.diff

File 19392.diff, 1.2 KB (added by sillybean, 11 years ago)

Add auto-suggest support for all flat taxonomies in Bulk Edit

  • src/wp-admin/js/inline-edit-post.js

     
    104104                        $('#ttle'+id).remove();
    105105                });
    106106
    107                 // enable autocomplete for tags
     107                // enable autocomplete for taxonomies
    108108                if ( 'post' == type ) {
    109                         // support multi taxonomies?
    110                         tax = 'post_tag';
    111                         $('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 + ' ' } );
     109                        $('.inline-edit-tags textarea').each(function(){
     110                                var terms = $(this).text(),
     111                                        taxname = $(this).attr('class').replace('tax_input_', ''),
     112                                        comma = inlineEditL10n.comma;
     113
     114                                if ( terms ) {
     115                                        if ( ',' !== comma )
     116                                                terms = terms.replace(/,/g, comma);
     117                                        $(this).val(terms);
     118                                }
     119
     120                                $(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } );
     121                        });
     122
     123
    112124                }
    113125                $('html, body').animate( { scrollTop: 0 }, 'fast' );
    114126        },