I am working on an application other than Mac Mail. I have a webview that allows the user to write a new message. I implemented a drag and drop function so that the user can add an attachment to the message this way.
To make it simple, I have a main view that contains a WebView and other views. I implemented drag and drop on this main view (using the draggingEntered: and executeDragOperation :) methods, and it works as expected.
The problem is that by default, when you drag and drop a file inside a WebView, an image, for example, will be displayed in WebView. But I don't want this, I want it to be added as an attachment, so I turned off drag and drop inside the WebView:
def webView(sender, dragDestinationActionMaskForDraggingInfo:draggingInfo) WebDragDestinationActionNone end
But now my file will be added as an attachment if I drag it anywhere in the main view, except for WebView (in this case, calls to the draggingEntered: and executeDragOperation methods will not be called).
I donโt know if Iโm still new to Cocoa to answer the question, so feel free to tell me if you need more information. Another thing, I work with Rubymotion, but if you have a solution in Objective-C, it will also be great!
Thanks for any help or suggestion.
Decision
I subclassed WebView and redefined the performDragOperation method to make it work:
def performDragOperation(sender) self.UIDelegate.mainView.performDragOperation(sender) end