copy-to-clipboard
copy-to-clipboard copied to clipboard
Option to support text/html and text/plain in parallel when one or the other is available.
It would be great to have the option to support text/html and text/plain in parallel when one or the other is available.
For example: paste in notepad the text/plain and paste in MS Word text/html.
This worked for me
copyToClipboard(plainTxt, {
format: 'text/plain',
onCopy: (clipboardData) => {
// copy rich text also
clipboardData.setData('text/html', html);
}
});
onClick={() => {
const content = editorRef.current.getInstance().getHtml();
copy(content, {
format: 'text/plain',
onCopy: clipboardData => {
(clipboardData as any).setData('text/html', content);
message.success('Successfully copy daily report');
},
});
}}
@gargroh 's method is worked fine