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

Option to support text/html and text/plain in parallel when one or the other is available.

Open danvln opened this issue 5 years ago • 2 comments

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.

danvln avatar Oct 11 '20 22:10 danvln

This worked for me

copyToClipboard(plainTxt, {
	format: 'text/plain',
	onCopy: (clipboardData) => {
	  // copy rich text also
	  clipboardData.setData('text/html', html);
	}
});

gargroh avatar Oct 28 '20 10:10 gargroh

             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

leslie555 avatar May 31 '21 03:05 leslie555