[whatwg] contentEditable and drag and drop cancel

Charles Pritchard chuck at jumis.com
Tue Jan 31 23:11:09 PST 2012


On 1/31/12 10:55 PM, Ryosuke Niwa wrote:
> On Tue, Jan 31, 2012 at 10:51 PM, Ryosuke Niwa<rniwa at webkit.org>  wrote:
>
>> On Tue, Jan 31, 2012 at 10:16 PM, Charles Pritchard<chuck at jumis.com>wrote:
>>
>>> **
>>> Yes, that's correct -- I'm testing on Chrome.
>>>
>>> I'd like to drag and drop a file from the desktop into a position in the
>>> contentEditable with one action.
>>> But, it seems that I have to cancel the default action of drag (to get
>>> the file)
>>>
>> Why do you have to do that? And when?
>>
> I think I understand what you're saying now. For your use case, you should
> use dropzone content attribute:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#the-dropzone-attribute
>
> Then all you have to write is a drop event handler where you have access to
> clipboard data.


Well that certainly justifies the dropzone attribute. Have any vendors 
implemented it?

For authors: you can capture your ondragover events on your entire page, 
via the ondragover/ondragenter hooks, and simply use stopPropagation on 
them inside of your contentEditable. However, I don't see support for 
dropzone in the current Chrome (that's M16), and the WHATWG page has not 
documented any implementations amongst the vendors.

-Charles




More information about the whatwg mailing list