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

Editor Drag and Drop

1 Answer 48 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 20 Nov 2008, 10:59 PM
Hi,

Is it possible to catch a drag and drop event to the editor from an external application (like notepad).

For example, someone selects a paragraph of text in notepad, clicks and drags into internet explorer into the editor and releases.

It correctly inserts the text into the editor, but I'd like to catch the event. It doesn't trigger an onpaste event.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 21 Nov 2008, 01:09 PM
Hi Jeff,

You should attach to the IE drop and FF dragdrop events as it is shown below:

<script type="text/javascript">
function OnClientLoad(editor, args)
{
   var element = document.all ? editor.get_document().body : editor.get_document();
   var eventHandler  = document.all ? "drop" : "dragdrop";
   $telerik.addExternalHandler(element, eventHandler, function(e)
   {
       setTimeout(function()
       {
        alert("before stripping" + editor.get_html(true));
        editor.fire("SelectAll");
        editor.fire("FormatStripper", {value : "WORD_ALL"}); //strips the MS Word formatting
        alert("after stripping" + editor.get_html(true));
      }, 300);
   });
}
</script>
<telerik:radeditor
   runat="server"
   OnClientLoad="OnClientLoad"
   ID="RadEditor1">
</telerik:radeditor>

Please, note that the onpaste event is fired only when pasting content, but not when drag and dropping it.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Jeff
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or