WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#49434 closed feature request (duplicate)

Copy link functionality in Media not working

Reported by: 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 14 months ago.
WordPress Media upload - copy link

Download all attachments as: .zip

Change History (4)

@sharduld
14 months ago

WordPress Media upload - copy link

#1 @sharduld
14 months 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
14 months 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
14 months ago

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