Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance paste functionality #112

Open
DuncanWilder opened this issue Apr 19, 2016 · 1 comment
Open

Enhance paste functionality #112

DuncanWilder opened this issue Apr 19, 2016 · 1 comment

Comments

@DuncanWilder
Copy link

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/

@bampakoa
Copy link
Contributor

@stevermeister I think this could be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants