owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

Add a 'copy PNG to clipboard' shortcut

Open edomt opened this issue 2 years ago • 4 comments

Core problem

Currently, the option for users to re-use a 'pretty' version of a chart is to click Download > Image (PNG) > the PNG is downloaded > upload somewhere else (e.g. social media). This feels a bit cumbersome and results in users who often take screenshots of our charts; this can reduce image quality and/or remove some elements (e.g. footnotes).

Proposed solution

Add a "Copy chart" shortcut in the sharing menu, that would directly copy the PNG version of our chart to the clipboard.

image

Context

Slack thread

edomt avatar May 17 '22 12:05 edomt

Technical note: Something like this could work, but haven't tried it

const clipboardItem = new ClipboardItem(
  { "image/png": this.pngBlob }
)
navigator.clipboard.write([ clipboardItem ])

It uses the relatively modern Clipboard API, which is supported in most recent browser versions.

marcelgerber avatar May 17 '22 14:05 marcelgerber

I've tried this now - this definitely works using the above piece of code. So all we need for this is a working design for the download tab, and then afterwards I would estimate this to be 2-3 hours of work.

marcelgerber avatar May 17 '22 20:05 marcelgerber

Probably copy to clipboard is more explicit and should live under the share menu instead of in the download tab?

danyx23 avatar May 24 '22 11:05 danyx23

This issue has had no activity within 10 months. It is considered stale and will be closed in 7 days unless it is worked on or tagged as pinned.

github-actions[bot] avatar Apr 30 '24 07:04 github-actions[bot]