Problem

This module embeds zeroclipboard to provide the 'Copy' button.

Zeroclipboard is based on Flash which is kind of obsolete these days.

Some people have asked the maintainers to provide an non-Flash based alternative: https://github.com/zeroclipboard/zeroclipboard/issues/552

Proposed resolution

A possible alternative is clipboardjs, as mentioned here: https://github.com/h5bp/lazyweb-requests/issues/184

There is already a Drupal module that integrates this library: https://www.drupal.org/project/clipboardjs

How about switching from zeroclipboard to clipboardjs ? Here is a proposed patch.

Comments

fengtan created an issue. See original summary.

fengtan’s picture

Status: Active » Needs review
StatusFileSize
new23.15 KB
karolinam’s picture

Title: Replace zeroclipboard with non-flash-based library » Add non-flash-based clipboard copying
StatusFileSize
new3.75 KB

I would like to suggest adding the non-flash-based clipboard copying, instead of replacing it, for backwards compatibility. If the clipboardjs module is enabled the non-flash copy will be used, otherwise copy with zeroclipboard will still work.

I modified the issue title and am submitting a patch with this change, plus in-line styling for the short URL.

karolinam’s picture

Submitting another patch with some styling changes.

fengtan’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new18.5 KB
new19.06 KB

Reviewed and tested #4 -- looks good. I have attached screenshots so folks can easily see what is changing.

How to test this:

  • Install and enable clipboardjs
  • Install the clipboardjs library in modules/all/libraries (or run drush clipboard-download-library)
  • Go to /shurly and shrink a URL
  • The 'copy' button is now based on clipboardjs instead of zeroclipboard, so Chrome/Firefox do not ask the user to confirm whether Flash should be activated in order to click on the button

  • Jibus committed 0ff396a on 7.x-1.x authored by karolinam
    Issue #2929302 by karolinam, fengtan: Add non-flash-based clipboard...
jibus’s picture

Status: Reviewed & tested by the community » Fixed

Excellent ! Commited against 7.x-1.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.