Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-05-23 15:56:50

jcsalem
New member
Registered: 2006-04-10
Posts: 4

Prevent drag/drop into htmlarea?

On IE6, content can be dragged and dropped into the HTMLArea's iframe.  Is there any way to disable this functionality or have a handler function called before the drop is done?

What's particularly a problem is that images can be dragged and dropped into the iframe.  They display correctly in the iframe even though they are only on the user's local machine. I'd like to prevent this from happening.

Offline

#2 2006-05-24 03:56:56

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Prevent drag/drop into htmlarea?

Submit a feature request http://xinha.python-hosting.com/wiki/Tickets but I'm not sure if it's possible


James Sleeman

Offline

#3 2006-05-24 13:56:57

jcsalem
New member
Registered: 2006-04-10
Posts: 4

Re: Prevent drag/drop into htmlarea?

I solved it by overriding the drag handlers. It also occurs on Firefox. 

Of course, the ideal thing would be to add an ondrop handler to actually parse the the image/code being dragged and do the appropriate thing (e.g., automatically upload the image).  However, this doesn't seem to be possible as the HTML/image content being dragged is not accessible. [On IE, look at the dataTransfer.getData method which only returns URLs and text data.  If you're dragging an image or HTML you're out of luck.]

Here is the code I'm using to stop the dragging:

function DisableDragging(editor)
    {
    if (HTMLArea.is_ie)
        {
        // IE
        HTMLArea._addEvent(editor._doc.body,"dragenter", function() {return false;});        
        }
    else 
        {
        // Firefox
        HTMLArea._addEvent(editor._doc, "dragover", function(ev) {HTMLArea._stopEvent(ev); return false;});
        HTMLArea._addEvent(editor._textArea,"dragover", function(ev) {HTMLArea._stopEvent(ev); return false;});
        }
    }

-- Jim

Offline

Board footer

Powered by FluxBB