ngWig icon indicating copy to clipboard operation
ngWig copied to clipboard

Enhance paste functionality

Open DuncanWilder opened this issue 9 years ago • 1 comments

Currently, pasting using a custom function calls this line

var pasteContent = (event.originalEvent || event).clipboardData.getData('text/plain');

This tries to get the plain text of the line. But if we want the HTML content, we must perform our own actions on the event object. The paste functionality could be enhanced to (optionally) try to get HTML first, then plain text second.

var contentToProcess = (event.originalEvent || event).clipboardData.getData('text/html');

if (!contentToProcess) {
   contentToProcess = (event.originalEvent || event).clipboardData.getData('text/plain');
}

Though, you will run into issues on IE due it it only accepting Text as a parameter of getData. Will need to consider this article to try and get pasting HTML to work on IE https://www.lucidchart.com/techblog/2014/12/02/definitive-guide-copying-pasting-javascript/

DuncanWilder avatar Apr 19 '16 09:04 DuncanWilder

@stevermeister I think this could be closed.

bampakoa avatar Jun 13 '16 17:06 bampakoa