WordPress.org

Make WordPress Core

Changeset 22699


Ignore:
Timestamp:
11/20/2012 02:35:30 AM (8 years ago)
Author:
koopersmith
Message:

Media: Improve media buttons on the front end.

  • Use a less specific selector (the body, actually) to delegate opening the media dialog.
  • Allow the editor ID to be the empty string so the media_buttons action can be called without arguments.

see #22284, #21390.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r22679 r22699  
    391391
    392392    $img = '<span class="wp-media-buttons-icon"></span> ';
     393
     394    error_log( 'MEDIA_BUTTONS ' . print_r( func_get_args(), true ) );
    393395
    394396    echo '<a href="#" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>';
  • trunk/wp-admin/js/media-upload.js

    r22672 r22699  
    435435
    436436        init: function() {
    437             $('#wpbody').on('click', '.insert-media', function( event ) {
     437            $(document.body).on('click', '.insert-media', function( event ) {
    438438                var $this = $(this),
    439439                    editor = $this.data('editor'),
     
    449449                $this.blur();
    450450
    451                 if ( ! editor )
     451                if ( ! _.isString( editor ) )
    452452                    return;
    453453
Note: See TracChangeset for help on using the changeset viewer.