This is a migrated thread and some comments may be shown as answers.

Editor inside usercontrol - OnClientPasteHtml event doesn't fire

5 Answers 81 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 11 Feb 2014, 08:47 PM
Hello

I've got a user control featuring the RadEditor, and I've been using the OnClientPasteHtml event handler to strip out html pasted into the content pane via Ctl-V.  I'm maintaining a clients' code base and they report this was working okay until recently.  They're using 2013.2.717.45 of Telerik.Web.UI.

I've found that the unwrapped version of RadEditor fires OnClientPasteHtml just fine.  If I create a usercontrol, add an Editor instance with the exact same configuration, and add the usercontrol to the page, the client side event no longer fires.

Issue occurs in IE11, FF, Chrome and Safari.

Help or guidance would be appreciated, thanks very much.

Michael

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Feb 2014, 06:06 AM
Hi Michael,

Unfortunately I couldn't replicate the issue at my end. Please have a look into the following code snippet which works fine at my end.

ASCX:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientPasteHtml="OnClientPasteHtml1">
</telerik:RadEditor>

JavaScript:
<script type="text/javascript">
    function OnClientPasteHtml1(sender, args) {
        alert(args.get_value());
    }
</script>

Please note that Safari and Chrome do not offer onpaste event and for that reason the OnClientPasteHtml event of RadEditor is not fired in these browsers when the paste command (Ctrl+v) is executed.

Thanks,
Shinu.
0
Sunil
Top achievements
Rank 1
answered on 13 Feb 2014, 03:25 PM
The issue seems to be when document mode is set to Edge. If this is forced to 10 or earlier this function appears to work. But on edge mode it doesn't work for me.
0
Ianko
Telerik team
answered on 13 Feb 2014, 04:12 PM
Hi,

I am unable to reproduce the problem with the default configuration of the RadEditor control. Note that if the editor is set with ContentAreaMode="Div" this event is not raising under FF, Chrome and Safari.

It would be helpful if you could provide more information about the used configuration, leading to the described behavior.

Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Matt
Top achievements
Rank 1
answered on 30 Jul 2018, 09:07 PM

It doesn't fire if ContentAreaMode='Iframe" either... or are there more values that I can guess my way through?

Or is this fixed in a later version that Q2 2015?

0
Rumen
Telerik team
answered on 31 Jul 2018, 08:19 AM
Hello Matt,

Can you please elaborate more on the issue by providing:
  • the RadEditor configuration - you can paste/attach the whole aspx page. If a masterpage is used, attach it too.
  • the browser version under which the problem occurs. If it is IE, make sure that the browser is not placed in Compatibility mode as explained in this article: How to check if the Compatibility mode is disabled.

Version Q2 2015 is old and does not officially support any of the modern browsers. Can you please perform an upgrade to 2018.2.710 to see whether the problem still persists.

After the upgrade test whether the alert will fire in the browser:


<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
    var commandName = args.get_commandName();
    var value = args.get_value();
     
    if (commandName == "Paste")
    {
       
        alert("Paste command executed");
 
    }
}
</script>

 


Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
Michael
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sunil
Top achievements
Rank 1
Ianko
Telerik team
Matt
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or