let provider = NSItemProvider()
if model.type == .rich {
if let attr = NSAttributedString(
with: model.data,
type: model.pasteboardType
) {
//return NSItemProvider(object: attr as NSString)
}
provider.registerDataRepresentation(
forTypeIdentifier: model.pasteboardType.rawValue,
visibility: .all,
) { completion in
completion(model.data, nil)
return nil
}
}
.onDrop(
of: [
.text,
.rtf,
.rtfd,
.fileURL,
.png,
.tiff,
.data,
],
isTargeted: $isDropTargeted,
) { providers in
if chip.isSystem {
return false
}
if vm.draggingItemId != nil {
handleDrop(providers: providers)
return true
}
return false
}
How should I handle this? Also, there's another issue: when dragging within the app, why doesn't the preview image automatically shrink at the receiving end, but it works correctly when dragging outside the app?