Skip to content

Feature: Drag and Drop #6

@KristofferStrube

Description

@KristofferStrube

I have looked at adding support for the Drag and Drop part of the API which is defined like this in the Web IDL specs:

partial interface DataTransferItem {
    Promise<FileSystemHandle?> getAsFileSystemHandle();
};

This means that it is an extension on the existing WebIDL definition of the DataTransferItem.

Blazor has a matching class for the DataTransferItem which can be seen here in the docs

The problem with that class is that it is indeed handled as a POCO when parsed to JS through JSInterop. This means that we will only get the two properties that exist on the object not a posibility to call JS function on the object itself from i.e. the previously described extension.

This has been tested on a feature branch of this project https://github.com/KristofferStrube/Blazor.FileSystemAccess/tree/feature/DragAndDrop

Which currently gives an error when we try to invoke getAsFileSystemHandle() or any other existing DataTransferItem methods.

This is the expected behaviour. What could be nice would be if the DataTransferItem from C# would (or could) be interpreted as the JS reference so that people can call the native browser methods on the object.

It is planned to open an issue on the aspnetcore repository once I have collected more information about how the DataTransferItem is currently handled in the project and when I have found some approach that would make this possible without bloating the existing object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions