Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drop on WebView?



On Feb 22, 2006, at 5:50 AM, Benjamin Miller wrote:
Is it possible to drop any pboard type onto a WebView?

I believe so. Check out:
/Developer/Examples/Dashboard/Dropper/
Also for reference:
http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/DragAndDrop.html

You'll also need to implement some Webview UI Delegates (first one optional):
- (unsigned) webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo 
- (void)webView:(WebView *)sender willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id <NSDraggingInfo>)draggingInfo

However, by default, images and html files dropped onto a Webview will cause the view to reload them as the new source. I'm not sure of the best way to prevent this.

I ended up returning WebDragDestinationActionDHTML for the "dragDestinationActionMaskForDraggingInfo" delegate and included the _javascript_ functions in the Dropper example. This works and I can handle the drop in the "willPerformDragDestinationAction" delegate. An undesirable side-effect is that drops are only accepted if they are over the rendered <body> of the page. In other words, if you have a page with only a few sentences, then drops outside the rendered area (below those sentences) are inactive. This makes some sense since I'm using WebDragDestinationActionDHTML but I'd like the entire Webview to accept drops. This would be especially problematic for an empty Webview.

I tried returning (WebDragDestinationActionAny & ~WebDragDestinationActionLoad) without success either. I think WebDragDestinationActionLoad may be required to enable a non-editable webview to recognize a drop anywhere, but there must be some way of suppressing the load action.

I'd be pleased if anyone can shed some light on this.

Thanks,
george
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden

References: 
 >Drop on WebView? (From: Benjamin Miller <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.