WordPress.org

Make WordPress Core

Ticket #16435: 16435.patch

File 16435.patch, 1.2 KB (added by mauteri, 5 years ago)

This triggers "Insert into post" on return and also returns focus back to modal after upload.

  • wp-includes/js/media/views/modal.js

     
    205205                        this.escape();
    206206                        event.stopImmediatePropagation();
    207207                }
     208
     209                // Insert into post when return is pressed.
     210                if ( 13 === event.which && this.$el.is(':visible') ) {
     211                        this.$el.find('.media-button-insert').trigger('click');
     212                }
    208213        }
    209214});
    210215
  • wp-includes/js/media/views/uploader/status.js

     
    88 * @augments wp.Backbone.View
    99 * @augments Backbone.View
    1010 */
    11 var View = wp.media.View,
     11var $ = jQuery,
     12        View = wp.media.View,
    1213        UploaderStatus;
    1314
    1415UploaderStatus = View.extend({
     
    9899                this.$index.text( index + 1 );
    99100                this.$total.text( queue.length );
    100101                this.$filename.html( active ? this.filename( active.get('filename') ) : '' );
     102
     103                // Move focus back to modal.
     104                $('.media-modal').parent().eq(0).focus();
    101105        },
    102106        /**
    103107         * @param {string} filename