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

how to Disable Drag and drop in editor.

8 Answers 145 Views
Editor
This is a migrated thread and some comments may be shown as answers.
ravi
Top achievements
Rank 1
ravi asked on 16 Mar 2012, 08:11 AM
i am facing issue, when trying to disable the drag and drop in radEditor. i refered the following Code. but it is not working for any browser. http://www.telerik.com/community/forums/aspnet-ajax/editor/disable-images-drag-and-drop.aspx
BRowsers : IE 9, Firefox 11, and Chrome.

<telerik:RadEditor ID="txtsomeID" runat="server" Width="100%" AutoResizeHeight="false"
Height="300px" TabIndex="1" StripFormattingOnPaste="All" EnableResize="false"
OnClientLoad="OnClientLoad" OnClientSubmit="OnClientSubmit">
<Content></Content>
<ContextMenus>
<telerik:EditorContextMenu Enabled="false" />
<telerik:EditorContextMenu TagName="IMG" Enabled="false" />
<telerik:EditorContextMenu TagName="TABLE" Enabled="false" />
</ContextMenus>
</telerik:RadEditor>

and the Java scrtipt  and even OnClientLoad is not Firing at all
<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) { $telerik.cancelRawEvent(e); return false; });
      }
 
      function OnClientSubmit(editor) {
          editor.fire("FormatStripper", { value: "ALL" });
      }
</script>

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Mar 2012, 11:06 AM
Hello,

Can you tell me the teleriks version that you are using? I was not able to reproduce the issue with the  telerik version 2012, 1, 215, 35 in Browsers IE9, Firefox 11 and Chrome.
One suggestion is to upgrade to the latest version and try again. You can Refer to Updating RadControls for ASP.NET AJAX to another version or license  for more information.

Thanks,
Princy.
0
ravi
Top achievements
Rank 1
answered on 16 Mar 2012, 11:26 AM
i am using Telerik version. 2011.2.915.35,  can you give me a small demo how to disable drag and drop in editor
0
Rumen
Telerik team
answered on 20 Mar 2012, 12:59 PM
Hi,

The code works for version 2011.2.915.35.

You have missed the closing " quote in the <script type="text/javascript> declaration which, makes the JavaScript invalid and the code in it will not work and prevent the drag and drop in the content area. Here is a video demonstrating that the code works: http://screencast.com/t/ZL87syCO4kt.

Please, note that this custom functionality is not offered by RadEditor out-of-the box and we do not support it. You can use the example code just as a base to implement your requirements.

Greetings,
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.
0
ravi
Top achievements
Rank 1
answered on 27 Mar 2012, 01:44 PM
i used the same code, but it is getting disable for the first time, if i refreshed the page,  but this fololowing event is not fired at all, only for the first time it will load, other time it will not work,  i am using firefox nightly, Chrome Latest version. Even i tried debugging in firebug, but onclientload event is not firing at the second time, it will open for the first time (i.e when if you right click and refresh the page , it will no work, again if u open the page, then for the first time it will work,. )
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) { $telerik.cancelRawEvent(e); return false; });
0
Rumen
Telerik team
answered on 29 Mar 2012, 04:10 PM
Hi,

Do you experience the problem with the official build of Firefox 11 or only in the nightly builds? Note that we do not support beta browsers.

Best 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.
0
ravi
Top achievements
Rank 1
answered on 30 Mar 2012, 05:48 AM
ok, but it also not work in Firefox 11, but it works in IE9, without issues, i am not getting the idea, why it is not working in the Firefox or chrome, as i mentioned the above code which i have tried, it is even not firing the event handler during the page load. so if possible can you give me alternate solution, it would be great
0
Rumen
Telerik team
answered on 03 Apr 2012, 12:11 PM
Hello,

Note that this code works to prevent the drag and drop in the content area. The user will be able to drag content outside of the content area and drop it inside. If you want to prevent the drag and drop from outside you should apply the following CSS properties to the content that you want to make unselectable:

<div unselectable="on" style="-moz-user-select: none;-webkit-user-select: none;">test content</div>

I was also unable to reproduce the refresh problem as shown in the following video: http://screencast.com/t/km2anDJU.

Best 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.
0
harshini
Top achievements
Rank 1
answered on 19 Apr 2017, 07:10 AM

hi 

Can you please help me on below question

When I am clicking on the image manage button from rad editor we used to get it's appropriate pop up window right ....

When that pop up comes onto our screen ,user should not able to drag it 

Can we disable that windows drag option.

I want the window should not move ,is there any property for that in telerik rad editor

I am new to this tool,Please help on this

thanks,

Harshini

Tags
Editor
Asked by
ravi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
ravi
Top achievements
Rank 1
Rumen
Telerik team
harshini
Top achievements
Rank 1
Share this question
or