WordPress.org

Make WordPress Core

Ticket #51754: 51754.4.diff

File 51754.4.diff, 3.2 KB (added by antpb, 4 months ago)

Work in progress, removes unwanted changes from previous patch.

  • src/wp-admin/async-upload.php

     
    6060
    6161                        // Title shouldn't ever be empty, but use filename just in case.
    6262                        $file  = get_attached_file( $post->ID );
     63                        $fileurl  = wp_get_attachment_url( $post->ID );
    6364                        $title = $post->post_title ? $post->post_title : wp_basename( $file );
    64                         echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</span></div>';
     65
     66                        // @todo make a class for this field.
     67                        ?>
     68                        <div class="edit-attachment">
     69                                <span class="copy-to-clipboard-container-uploader">
     70                                <button type="button" class="button button-small copy-attachment-url-uploader copy-button" data-clipboard-text="<?php echo  $fileurl; ?>"><?php _e( 'Copy URL to clipboard' ); ?></button>
     71                                        <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
     72                                </span>
     73                        </div>
     74                        <?php                                           
     75                        echo '<div class="new"><span class="media-list-title"><strong>' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</strong></span> <span class="filename media-list-subtitle">' . esc_html( basename( $file ) ) . '</span></div>';
    6576                        break;
    6677                case 2:
    6778                        add_filter( 'attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2 );
  • src/wp-admin/css/media.css

     
    5151        max-width: 128px;
    5252}
    5353
     54.media-list-subtitle {
     55        display: block;
     56}
     57
     58.media-list-title {
     59        display: block;
     60}
     61
    5462#wpbody-content #async-upload-wrap a {
    5563        display: none;
    5664}
     
    819827        margin-left: 8px;
    820828}
    821829
     830.copy-to-clipboard-container-uploader {
     831        display: inline;
     832        align-items: center;
     833        margin-top: 8px;
     834        margin-right: 4px;
     835        clear: both;
     836}
     837
     838.copy-to-clipboard-container-uploader .copy-attachment-url-uploader {
     839        white-space: normal;
     840        margin-top: 4px !important;
     841}
     842
     843.copy-to-clipboard-container-uploader .success {
     844        color: #008a20;
     845        margin-left: 8px;
     846}
     847
    822848/*------------------------------------------------------------------------------
    823849  14.2 - Image Editor
    824850------------------------------------------------------------------------------*/
  • src/wp-includes/script-loader.php

     
    895895                $scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
    896896        }
    897897
    898         $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'plupload', 'jquery' ) );
     898        $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'clipboard', 'jquery', 'plupload', 'underscore', 'wp-a11y', 'wp-i18n' ) );
    899899        did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
    900900
    901901        $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );