ngWig
ngWig copied to clipboard
Enhance paste functionality
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/
@stevermeister I think this could be closed.