Ticket #802 (closed enhancement: inactive)

Opened 4 years ago

Last modified 4 months ago

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:
Cc:

Description

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;});		
    }
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;});
    }
}

Change History

Changed 4 years ago by jcsalem

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

Changed 2 years ago by ray

  • milestone set to 0.96

Changed 2 years ago by ray

  • owner deleted
  • type changed from defect to enhancement
  • component changed from Xinha Core to Plugins

Changed 1 year ago by ray

  • severity changed from normal to minor
  • milestone changed from 0.96 to 0.97

Changed 4 months ago by gogo

  • status changed from new to closed
  • resolution set to inactive

Inactive.

Note: See TracTickets for help on using tickets.