Skip to content

Commit

Permalink
Don't override drop operation if source view is webView (#2058)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1177771139624306/1206220522850248/f

Description:
For drags from webView to webView, apply default WebKit logic
  • Loading branch information
ayoy authored Jan 16, 2024
1 parent 0812aea commit f77ec1e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DuckDuckGo/Tab/View/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ final class WebView: WKWebView {
// MARK: - NSDraggingDestination

override func draggingUpdated(_ draggingInfo: NSDraggingInfo) -> NSDragOperation {
if draggingInfo.draggingSource is WebView {
return super.draggingUpdated(draggingInfo)
}
if NSApp.isCommandPressed || NSApp.isOptionPressed {
return superview?.draggingUpdated(draggingInfo) ?? .none
}
Expand All @@ -190,6 +193,9 @@ final class WebView: WKWebView {
}

override func performDragOperation(_ draggingInfo: NSDraggingInfo) -> Bool {
if draggingInfo.draggingSource is WebView {
return super.performDragOperation(draggingInfo)
}
if NSApp.isCommandPressed || NSApp.isOptionPressed || super.draggingUpdated(draggingInfo) == .none {
return superview?.performDragOperation(draggingInfo) ?? false
}
Expand Down

0 comments on commit f77ec1e

Please sign in to comment.