Pasting image into RadzenHtmlEditor 5.0.9 does not raise OnPaste event #1344

Closed
opened 2026-01-29 17:52:20 +00:00 by claunia · 0 comments
Owner

Originally created by @jafin on GitHub (Aug 15, 2024).

Describe the bug

Using Radzen Blazor HtmlEditor v5.0.9

I have not enabled the toolbar with Editor support for RadzenHtmlEditorImage
I have a Method wired to OnPaste event

private Task OnPaste(HtmlEditorPasteEventArgs arg)
  {
      arg.Html = sanitizer.Sanitize(arg.Html);
      return Task.CompletedTask;
  }
<RadzenHtmlEditor @bind-Value=@Value Change="@OnChange" Name="@Name" @onfocusin="OnFocusIn" Paste="@OnPaste" @onfocusout="OnFocusOut"  ShowToolbar="@ShowToolbar" style="@Style">
....
</RadzenHtmlEditor>

When a user pastes an image inside the editor, the OnPaste even does not trigger. (not good)
When a user pastes text the OnPaste even does trigger. (good)

Since OnPaste does not fire, I'm unable to sanitize and remove the inline encoded img tag.
This can be done via OnChange, but it would be beneficial if OnPaste activated for such an event.

To Reproduce
Steps to reproduce the behavior:

  1. RadzenHtmlEditor, no RadzenHtmlEditorImage enabled
  2. Paste an image
  3. Expect the OnPaste event to fire.
  4. It does not.

Expected behavior
When a user pastes an image, and it is encoded inline, the OnPaste even should trigger.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version 125.0.6422.142 (Official Build) (64-bit)
Originally created by @jafin on GitHub (Aug 15, 2024). **Describe the bug** Using Radzen Blazor HtmlEditor v5.0.9 I have not enabled the toolbar with Editor support for `RadzenHtmlEditorImage` I have a Method wired to `OnPaste` event ```c# private Task OnPaste(HtmlEditorPasteEventArgs arg) { arg.Html = sanitizer.Sanitize(arg.Html); return Task.CompletedTask; } ``` ```html <RadzenHtmlEditor @bind-Value=@Value Change="@OnChange" Name="@Name" @onfocusin="OnFocusIn" Paste="@OnPaste" @onfocusout="OnFocusOut" ShowToolbar="@ShowToolbar" style="@Style"> .... </RadzenHtmlEditor> ``` When a user pastes an image inside the editor, the `OnPaste` even does not trigger. (not good) When a user pastes text the OnPaste even does trigger. (good) Since OnPaste does not fire, I'm unable to sanitize and remove the inline encoded img tag. This can be done via OnChange, but it would be beneficial if OnPaste activated for such an event. **To Reproduce** Steps to reproduce the behavior: 1. RadzenHtmlEditor, no RadzenHtmlEditorImage enabled 2. Paste an image 3. Expect the OnPaste event to fire. 4. It does not. **Expected behavior** When a user pastes an image, and it is encoded inline, the OnPaste even should trigger. **Desktop (please complete the following information):** - OS: Windows - Browser Chrome - Version 125.0.6422.142 (Official Build) (64-bit)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1344