Closed AlexVallat closed 5 years ago
Hi there, sorry for super late response.
This API is available, but unfortunately Firefox and Chrome has different support on it.
Specifically, Chrome will check if the command is executed on a "focused document". So it's available in Content Script or Popup only (no Background Page).
You can see this file for details and workaround. https://github.com/chitsaou/copy-as-markdown/blob/master/src/background/clipboard-access.js
Cheers!
Clipboard.writeText is an API specifically for writing to the clipboard. It would avoid the need to create an invisible textarea and exec a copy command on it, and in Firefox would avoid the need for a content-script (as background scripts can use that API)