[Blazor] How to get the pasted content from Blazor `onpaste` native event
See original GitHub issueHow to get the pasted content from Blazor onpaste native event.
I want to filter the copy and paste the Microsoft word document content into contenteditable DIV.
Please suggest for “How can I achieve it in blazor native approach?”
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:17 (8 by maintainers)
Top Results From Across the Web
How to get pasted text in blazor?
I have input , which on I want to paste text. I use inPaste event and how I can pasted text? <Blazorise.Addon AddonType="Blazorise....
Read more >ASP.NET Core Blazor event handling
Learn about Blazor's event handling features, including event argument ... code tells the browser that when a native paste event occurs:.
Read more >Blazor .NET 6 – Custom Events – Pasting Images Like on Twitter
In this post we are going to implement a "multimedia paste". What we will do is allow users to paste both text and...
Read more >Copy to Clipboard in Blazor
In this post, I show how to copy text to the users clipboard in Blazor. I discuss two potential JavaScript APIs that can...
Read more >Element: paste event - Web APIs | MDN
A handler for this event can access the clipboard contents by calling getData() on the event's clipboardData property.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pandiyarajm93 No, sorry - custom event args are in 6.0.0 preview 2 onwards.
@Joren-Thijs @TanayParikh This has been supported since 6.0: https://docs.microsoft.com/en-us/aspnet/core/blazor/components/event-handling?view=aspnetcore-6.0#custom-clipboard-paste-event-example
The reason people need to do this as a custom event is that developers need to choose whether or not to serialize the data across to .NET, which might be expensive (e.g., in the case of Blazor Server it goes over the network).
@javiercn I see you labelled this as
reevaluate. Are you hoping for us to make further enhancements in this area? Or can it be closed as done?I guess we could implement a “built-in custom event” that does this but it requires some subtlety, for example you probably don’t want to send across all the data eagerly, but rather want to send some stream that developers can optionally read, and then the developer also has to understand it’s their responsibility to dispose it. Keeping all these design choices with the app developer is why it’s a matter of implementing a custom event today.