clipboard-apis
clipboard-apis copied to clipboard
Discoverability of custom type support
Some implementations support adding custom types on the clipboard, some do not. This is presumably a temporary state while implementations (and the spec) improve(s) - however, should there be a way to feature-detect whether custom types are supported?
Perhaps we should add ClipboardData.prototype.supportedTypes = ['text/plain', 'text/html', ... 'custom'] - or something like that?
I wonder why one would like to detect this: isn't it just easier to always attach a custom type even if not supported ?
In Wikipedia's VisualEditor we store the a clipboard key in the custom type that refers to our custom model data stored in memory. If the custom type isn't available we store this key in an empty span in the HTML type, but it is wasteful to do that the custom type is supported.
So, in general: you may want to know if you need to store your custom data in another way if extra MIME type storage is not available.