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

[Solved] Drag and drop html content at the cursor position

3 Answers 138 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Shiv
Top achievements
Rank 1
Shiv asked on 16 Jul 2009, 02:48 PM
I've a treeview with folders containing html templates (can be any valid html content). I'm able to drag and drop those html templates to the RadEditor. What I want to do is to drop the templates at the cursor position in the RadEditor. I'm using pasteHtml and it is always inserting it at the very beginning and not at the cursor position in the editor.

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 21 Jul 2009, 10:32 AM
Hello Shiv,

Did you try to set the unselectable="on" attribute to all treeview nodes as it is demonstrated in the following live example: Drag and Drop Images in RadEditor:

function OnClientLoad(editor)
        {
            var tree = $find("<%= RadTreeView1.ClientID %>");
            makeUnselectable(tree.get_element());
        }

 //Make all treeview nodes unselectable to prevent selection in editor being lost
        function makeUnselectable(element)
        {
            var nodes = element.getElementsByTagName("*");
            for (var index = 0; index < nodes.length; index++)
            {
                var elem = nodes[index];
                elem.setAttribute("unselectable","on");
            }
        }



All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Shiv
Top achievements
Rank 1
answered on 22 Jul 2009, 09:56 PM
Since I'm loading the nodes on demand the client side setAttribute("unselectable","on") is not working. I tried node.Attributes["unselectable"] = "on"; on the code behind in NodeExpand event handler but it is not working either. Any ideas?
0
Svetlina Anati
Telerik team
answered on 28 Jul 2009, 02:31 PM
Hello Shiv,

I am not sure about your exact setup and why you experience problems with setting this attribute. What I can suggest is to try whether setting the attribute on teh client in the OnClientNodePopulated event makes any difference. More information about the event is available below:

http://www.telerik.com/help/aspnet-ajax/tree_clientonclientnodepopulated.html

If this does not help, please try just for the test whetehr upgrading to teh latest Q2 release works as expected.

If this also does not help, provide a sample fully runnable reproduction demo and we will do our best to help. 

Kind regards,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Shiv
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Shiv
Top achievements
Rank 1
Share this question
or