Skip to content

Commit

Permalink
Add webkitRelativePath to dragdrop with multiple folders (#190)
Browse files Browse the repository at this point in the history
* File folder path drag drop (#1)

* .

* Add TypeScript MSBuild

* Add Check in GetFiles for missing files. Get from dragdrop instead.

* Update Demos

* Use native input functionality for drag / drop. Add option to switch between using webkitdirectory. Use div / ondrop to drop multiple folders and files.

* Move property to non standard properties

* Update Demo

* Fix/Cleanup

* Fix async issue

* remove try catches not needed and rethrow others
  • Loading branch information
cwinland authored Jun 5, 2023
1 parent 73fb7c9 commit 0374882
Show file tree
Hide file tree
Showing 28 changed files with 1,635 additions and 1,273 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,5 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/
/src/Blazor.FileReader/script/package-lock.json
/src/Blazor.FileReader/package-lock.json
182 changes: 93 additions & 89 deletions src/Blazor.FileReader/Blazor.FileReader.csproj
Original file line number Diff line number Diff line change
@@ -1,89 +1,93 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">


<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net6.0</TargetFrameworks>
<BlazorLinkOnBuild>true</BlazorLinkOnBuild>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Tor Knutsson (Tewr)</Authors>
<PackageProjectUrl>https://github.com/Tewr/BlazorFileReader</PackageProjectUrl>
<RepositoryUrl>https://github.com/Tewr/BlazorFileReader</RepositoryUrl>
<Description>Create Read-Only file streams from file input elements or drop targets in Blazor.</Description>
<PackageTags>blazor blazor-component stream filestream file-stream read-file filereader</PackageTags>
<Configurations>Debug;Release;Ghpages</Configurations>
<PackageId>Tewr.Blazor.FileReader</PackageId>
<PackageReleaseNotes>fixes a bug under net6 that would throw PlatformNotSupportedException</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Tewr.Blazor.FileReader</AssemblyName>
<RootNamespace>Tewr.Blazor.FileReader</RootNamespace>
<AssemblyVersion>3.3.1.21360</AssemblyVersion>
<Version>3.3.1.21360</Version>
<FileVersion>3.3.1.21360</FileVersion>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

<PropertyGroup>
<NoWarn>1701;1702;NU5104</NoWarn>
<DocumentationFile>Tewr.Blazor.FileReader.xml</DocumentationFile>
</PropertyGroup>

<Target Name="BundleTypescript" BeforeTargets="CreateManifestResourceNames" Condition="'$(Configuration)'=='Debug'">
<!-- using ts-bundle to create a single output js file from several ts files -->
<Exec Command="tsc-bundle $(ProjectDir)tsconfig.json --outFile $(ProjectDir)wwwroot\FileReaderComponent.js --entryPoint FileReaderComponent --transform tsPreprocessor.js" />
</Target>


<ItemGroup>
<!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
<EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.3" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<Content Update="tsconfig.json">
<Pack>false</Pack>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Folder Include="Extensions\" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="vsxmd" Version="1.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<DefineConstants>$(DefineConstants);NETSTANDARD20</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
<DefineConstants>$(DefineConstants);NET5</DefineConstants>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Razor">


<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net6.0</TargetFrameworks>
<BlazorLinkOnBuild>true</BlazorLinkOnBuild>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Tor Knutsson (Tewr)</Authors>
<PackageProjectUrl>https://github.com/Tewr/BlazorFileReader</PackageProjectUrl>
<RepositoryUrl>https://github.com/Tewr/BlazorFileReader</RepositoryUrl>
<Description>Create Read-Only file streams from file input elements or drop targets in Blazor.</Description>
<PackageTags>blazor blazor-component stream filestream file-stream read-file filereader</PackageTags>
<Configurations>Debug;Release;Ghpages</Configurations>
<PackageId>Tewr.Blazor.FileReader</PackageId>
<PackageReleaseNotes>fixes a bug under net6 that would throw PlatformNotSupportedException</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Tewr.Blazor.FileReader</AssemblyName>
<RootNamespace>Tewr.Blazor.FileReader</RootNamespace>
<AssemblyVersion>3.3.1.21360</AssemblyVersion>
<Version>3.3.1.21360</Version>
<FileVersion>3.3.1.21360</FileVersion>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

<PropertyGroup>
<NoWarn>1701;1702;NU5104</NoWarn>
<DocumentationFile>Tewr.Blazor.FileReader.xml</DocumentationFile>
</PropertyGroup>

<Target Name="BundleTypescript" BeforeTargets="CreateManifestResourceNames" Condition="'$(Configuration)'=='Debug'">
<!-- using ts-bundle to create a single output js file from several ts files -->
<Exec Command="tsc-bundle $(ProjectDir)tsconfig.json --outFile $(ProjectDir)wwwroot\FileReaderComponent.js --entryPoint FileReaderComponent --transform tsPreprocessor.js" />
</Target>


<ItemGroup>
<!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
<EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.3" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<Content Update="tsconfig.json">
<Pack>false</Pack>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Folder Include="Extensions\" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="vsxmd" Version="1.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<DefineConstants>$(DefineConstants);NETSTANDARD20</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
<DefineConstants>$(DefineConstants);NET5</DefineConstants>
</PropertyGroup>

</Project>
Loading

0 comments on commit 0374882

Please sign in to comment.