Editor inside usercontrol - OnClientPasteHtml event doesn't fire

6 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Oct 2013

    Posted 11 Feb 2014 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Feb 2014 in reply to Michael Link to this post

    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.
  3. Sunil
    Sunil avatar
    1 posts
    Member since:
    Feb 2014

    Posted 13 Feb 2014 in reply to Shinu Link to this post

    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.
  4. Ianko
    Admin
    Ianko avatar
    1898 posts

    Posted 13 Feb 2014 Link to this post

    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.
  5. Matt
    Matt avatar
    98 posts
    Member since:
    Jun 2012

    Posted 30 Jul 2018 in reply to Ianko Link to this post

    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?

  6. Rumen
    Admin
    Rumen avatar
    14098 posts

    Posted 31 Jul 2018 Link to this post

    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.
Back to Top