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

OnClientPasteHtml not working in HTML mode of RadEditor

2 Answers 166 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Anwar
Top achievements
Rank 2
Anwar asked on 18 Apr 2012, 03:31 PM
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 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 20 Apr 2012, 05:26 PM
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!
0
Rumen
Telerik team
answered on 21 Apr 2012, 09:18 AM
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.
Tags
Editor
Asked by
Anwar
Top achievements
Rank 2
Answers by
Richard
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or