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

drag and drop images to editor in html mode

1 Answer 47 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aye Myint
Top achievements
Rank 1
Aye Myint asked on 09 Aug 2010, 05:35 AM
Hi,

I'm wondering if I can drag and drop images from treeview to html view of editor.
But unlike design view, I want to insert the html of the image like <img alt="xxxx" src="xxxx" /> when I drag and drop it to editor's html view.
I tried it in this demo example http://demos.telerik.com/aspnet-ajax/editor/examples/treeviewandeditor/defaultcs.aspx, but nothing happened when I dragged the image to html view.

Thank you in advance.
Aye

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Aug 2010, 04:49 PM
Hi Aye,

The Drag and Drop Images demo is designed to work only in Design mode of RadEditor. Here is the code that checks whether the mouse is placed over the IFRAME of RadEditor in Design mode:

Copy Code
//Check if the image is over the editor or not
function isMouseOverEditor(editor, events)
{
    var editorFrame = editor.get_contentAreaElement();
    var editorRect = $telerik.getBounds(editorFrame);
 
    var mouseX = events.clientX;
    var mouseY = events.clientY;
 
    if (mouseX < (editorRect.x + editorRect.width) &&
     mouseX > editorRect.x &&
        mouseY < (editorRect.y + editorRect.height) &&
     mouseY > editorRect.y)
    {
        return true;
    }
    return false;
}

Since we do not support the requested feature to drag and drop images in HTML mode, you could try to implement it yourself. The HTML mode of RadEditor is a TEXTAREA placed in another IFRAME element. You can get reference to this TEXTAREA control using the editor.get_textArea() method and implement your own code that will insert the treeview node content in it.


Best wishes,
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
Tags
Editor
Asked by
Aye Myint
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or