Opened 15 years ago

Closed 11 years ago

#802 closed enhancement (inactive)

Add a config option to disable dragging into an HTMLArea

Reported by: jcsalem Owned by:
Priority: normal Milestone: 0.97
Component: Plugins Version:
Severity: minor Keywords:


Dragging content, especially images, into the HTMLArea's iframe can be problematic. In the case of images, the image will appear in the iframe but when the HTMLArea is submitted the image will not be uploaded to the server. Only the link (which, for example, may be just a link to an image on the user's local machine) is saved.

To work around this, I want to disable dragging into the iframe. The code below implements this and would be nice to have as an HTMLArea config option.

Finally, I think 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.]

Anyway, here is the code I'm using to stop the dragging:

if (HTMLArea.is_ie)
    // IE
    HTMLArea._addEvent(editor._doc.body,"dragenter", function() {return false;});		
    // 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;});

Change History (5)

comment:1 Changed 15 years ago by jcsalem

Upon further reflection, perhaps this should be handled as a plug-in.

comment:2 Changed 13 years ago by ray

  • Milestone set to 0.96

comment:3 Changed 13 years ago by ray

  • Component changed from Xinha Core to Plugins
  • Owner gogo deleted
  • Type changed from defect to enhancement

comment:4 Changed 12 years ago by ray

  • Milestone changed from 0.96 to 0.97
  • Severity changed from normal to minor

comment:5 Changed 11 years ago by gogo

  • Resolution set to inactive
  • Status changed from new to closed


Note: See TracTickets for help on using tickets.