OnClientPasteHtml not working in HTML mode of RadEditor

3 posts, 0 answers
  1. Anwar
    Anwar avatar
    31 posts
    Member since:
    Aug 2011

    Posted 18 Apr 2012 Link to this post

    Hello friends,


    We are using RadEditor in our application.I am getting problem with OnClientPasteHtml() .This event is woking only when i paste something in Design mode and not working in HTML mode of RadEditor.
    I have also tried to attach onpaste event  but its also not firing when i paste something on Editor's HTML mode.
    I don't know where is going wrong in my code.
    This is my code,

    <script type="text/javascript">
     function OnClientLoad(editor, args) {                
                    editor.attachEventHandler("onkeydown", function(e) {
                        setTimeout(function() {                 
                        var length = $find("<%=RadEditor1.ClientID %>");
                           
                        }, 0);
                    });

                    editor.attachEventHandler("onpaste", function(e) {
                        setTimeout(function() {                      
                            var length = $find("<%=RadEditor1.ClientID %>");

                        }, 0);
                    });

                }


     </script>
    <
    telerik
    :RadEditor runat="server" ID="RadEditor1"
    StripFormattingOnPaste="NoneSupressCleanMessage" OnClientLoad="OnClientLoad"

     

    </telerik:RadEditor>
    onkeydown is working fine but onpaste not working.
    Any idea?

    Thanks in Advance
    Rehan


  2. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 20 Apr 2012 Link to this post

    Anwar:

    Please let us know what browser you are using when the OnClientPasteHtml fails. Be sure to reference the documentation page: OnClientPasteHtml which has a note at the bottom:

    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.


    Hope this helps!
  3. Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 21 Apr 2012 Link to this post

    Hi,

    The OnClientPasteHtml event is fired in Design mode only. The content area in HTML mode is a textarea and you can get a reference to it using the editor.get_textArea() method. You can find more information in this forum thread: How to capture HTML when pasted in HTML mode of RadEditor.

    Kind regards,
    Rumen
    the Telerik team
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top