Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#49434 closed feature request (duplicate)

Copy link functionality in Media not working

Reported by: sharduld's profile sharduld Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: ui, javascript Cc:

Description

  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");
});

Attachments (1)

screenshot-localhost-2020.02.14-16_49_47.png (1001.6 KB) - added by sharduld 5 years ago.
WordPress Media upload - copy link

Download all attachments as: .zip

Change History (4)

@sharduld
5 years ago

WordPress Media upload - copy link

#1 @sharduld
5 years ago

The code added in the description copies the link(to the clipboard) on clicking the "Copy Link" label highlighted in the attached screenshot.

#2 @sabernhardt
5 years ago

  • Keywords needs-patch removed
  • Resolution set to duplicate
  • Status changed from assigned to closed
  • Version 5.3.2 deleted

Duplicate of #48463.

Welcome to WordPress Trac!

Thanks for the report, and this is being tracked already in ticket:48463. We're exploring another approach, if you would like to join the discussion there.

#3 @desrosj
5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.