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

Disable Drag Drop Text

2 Answers 44 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Michael Pullella
Top achievements
Rank 1
Michael Pullella asked on 04 Aug 2010, 11:32 AM
Is it possible to prevent the user from dragging and dropping text in an editor (and therefore changing the text)

The editor currently is not allowing the user to change text via typing, they highlight existing words and "highlight them" via a custom toolbar.

We don't want the user to be able to change the text, but because they are able to select words, and drag them to a new location in the document, they are able to change the text of the document.

We still want the user to be able to hightlight text in the document, we just don't want them to be able to move it to a new location in the document.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 04 Aug 2010, 12:08 PM
Hi Michael,

You can disable drag and drop operations in the IFRAME content area of RadEditor using the JavaScript following code:

<script type="text/javascript">    
function OnClientLoad(editor, args)    
{    
   var element = document.all ? editor.get_document().body : editor.get_document();    
   var eventHandler  = document.all ? "drop" : "dragstart";    
   var selElem  = editor.getSelectedElement();
   $telerik.addExternalHandler(element, eventHandler, function(e) {
   setTimeout(function() { editor.undo(1); }, 10);
   $telerik.cancelRawEvent(e);
   });   
}     
</script>   
<telerik:radeditor runat="server"   
   OnClientLoad="OnClientLoad" 
   ID="RadEditor1">   
   <Content>sample content test <br/> test</Content> 
</telerik:radeditor>


All the best,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Pullella
Top achievements
Rank 1
answered on 04 Aug 2010, 12:47 PM
Once again, you saved the day!
Tags
Editor
Asked by
Michael Pullella
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Michael Pullella
Top achievements
Rank 1
Share this question
or