What "format" in clipboard.read(format[, type])


Hi, I am looking into using atom-shell for a project. I had a question about the clipboard though:

  1. clipboard.read(format[, type]): what is this “format”? I tried using “HTML”, “TEXT”, “text/plain”, etc… I tried googling for clipboard formats and couldn’t find much. Any hints? Thanks.

  2. Why is clipboard.read(format[, type]) marked as experimental and possibly removed in the future? I would like to be able to paste html and possibly images too. How would I do this? Particularly if read() goes away?

Many thanks for making “atom-shell” available to us!


Regarding question 1 I did a little searching in the source and found
atom-shell/atom/common/api/atom_api_clipboard.cc which requires ui/base/clipboard/clipboard.h. I could not find this file in the atom-shell project but I did find it in the Chromium source repo:

It mentions CBF_TEXT, CBF_HTML and a number of others.

A bit of further googling brings up CF_TEXT and CF_HTML in a MSDN article here https://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v=vs.85).aspx

I tried calling clipboard.has("CBF_HTML"), and all other formats I found while I had some HTML copied to my clipboard but the result was always false. Same result with *_TEXT formats.

Clearly I am not understanding how to use the clipboard.has and clipboard.read methods. Can anybody help shed some light on what these formats are please? Thanks!