Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 19a7763

Browse files
committed
Support dropping of tabs into another apps as URLs
1 parent 447fe83 commit 19a7763

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

DuckDuckGo/TabBar/View/TabBarCollectionView.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ class TabBarCollectionView: NSCollectionView {
3232
register(nib, forItemWithIdentifier: TabBarViewItem.identifier)
3333

3434
// Register for the dropped object types we can accept.
35-
registerForDraggedTypes([NSPasteboard.PasteboardType.string])
35+
registerForDraggedTypes([.URL])
36+
// Enable dragging items from our CollectionView to other applications.
37+
setDraggingSourceOperationMask([.every], forLocal: false)
3638
// Enable dragging items within and into our CollectionView.
37-
setDraggingSourceOperationMask(NSDragOperation.move, forLocal: false)
39+
setDraggingSourceOperationMask([.move], forLocal: true)
3840
}
3941

4042
func clearSelection() {

DuckDuckGo/TabBar/View/TabBarViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ extension TabBarViewController: NSCollectionViewDelegate {
370370
func collectionView(_ collectionView: NSCollectionView,
371371
pasteboardWriterForItemAt indexPath: IndexPath) -> NSPasteboardWriting? {
372372
if let url = tabCollectionViewModel.tabCollection.tabs[indexPath.item].url {
373-
return url.absoluteString as NSString
373+
return url as NSURL
374374
} else {
375-
return "" as NSString
375+
return URL.emptyPage as NSURL
376376
}
377377
}
378378

0 commit comments

Comments
 (0)