[wp-trac] [WordPress Trac] #49434: Copy link functionality in Media not working

WordPress Trac noreply at wordpress.org
Fri Feb 14 11:38:25 UTC 2020


#49434: Copy link functionality in Media not working
-----------------------------+-----------------------------
 Reporter:  sharduld         |      Owner:  (none)
     Type:  feature request  |     Status:  assigned
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Media            |    Version:  5.3.2
 Severity:  normal           |   Keywords:  needs-patch
  Focuses:  ui, javascript   |
-----------------------------+-----------------------------
 1. When you upload any WordPress media, a link of the uploaded media is
 displayed in the right sidebar of the modal(as highlighted in the attached
 screenshot). The label of the link is set as "Copy Link", but clicking on
 'Copy Link' does not copy the link to clipboard.

 I am not sure about the relevant JS file to add this code, so adding the
 code here-


 {{{
 jQuery(document).on('click', 'label[for="attachment-details-two-column-
 copy-link"]', function(){
         var copyText = document.getElementById("attachment-details-two-
 column-copy-link");

           /* Select the text field */
           copyText.select();
           copyText.setSelectionRange(0, 99999); /*For mobile devices*/

           /* Copy the text inside the text field */
           document.execCommand("copy");
 });
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49434>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list