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

Make onPaste also support text of type text/plain #210

Conversation

maartentenham
Copy link

Added support for text/plain when pasting text (from for example notepad++)

@stevermeister
Copy link
Owner

ha, interesting one!
thx @maartentenham !

let text = event.clipboardData?.getData('text/html') ?? '';
if (text.length == 0) {
text = event.clipboardData?.getData('text/plain') ?? '';
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to do even so:

let text = event.clipboardData?.getData('text/html') || event.clipboardData?.getData('text/plain') || '';

what do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks way better. I changed the PR.

@stevermeister stevermeister merged commit 6c3fee3 into stevermeister:master Jul 22, 2024
1 check passed
@stevermeister
Copy link
Owner

thx @maartentenham , published new version

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

Successfully merging this pull request may close these issues.

2 participants