Make WordPress Core

Ticket #28471: 28471.diff

File 28471.diff, 2.5 KB (added by camdensegal, 11 years ago)

Patch for suggest and inline-edit-post to allow for tag suggestion with only delimiter and no whitespace.

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

     
    110110                if ( 'post' === type ) {
    111111                        // support multi taxonomies?
    112112                        tax = 'post_tag';
    113                         $('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 + ' ' } );
     113                        $('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} );
    114114                }
    115115                $('html, body').animate( { scrollTop: 0 }, 'fast' );
    116116        },
     
    195195                                textarea.val(terms);
    196196                        }
    197197
    198                         textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } );
     198                        textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma} );
    199199                });
    200200
    201201                // handle the post status
  • wp-includes/js/jquery/suggest.js

     
    240240                        if ($currentResult) {
    241241                                if ( options.multiple ) {
    242242                                        if ( $input.val().indexOf(options.multipleSep) != -1 ) {
    243                                                 $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) );
     243                                                $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ) + options.multipleWhiteSpace;
    244244                                        } else {
    245245                                                $currentVal = "";
    246246                                        }
    247                                         $input.val( $currentVal + $currentResult.text() + options.multipleSep);
     247                                        $input.val( $currentVal + $currentResult.text() + options.multipleSep + options.multipleWhiteSpace);
    248248                                        $input.focus();
    249249                                } else {
    250250                                        $input.val($currentResult.text());
     
    294294
    295295                options = options || {};
    296296                options.multiple = options.multiple || false;
    297                 options.multipleSep = options.multipleSep || ", ";
     297                options.multipleSep = options.multipleSep || ",";
     298                options.multipleWhiteSpace = options.multipleWhiteSpace || " ";
    298299                options.source = source;
    299300                options.delay = options.delay || 100;
    300301                options.resultsClass = options.resultsClass || 'ac_results';