CurrieTechnologies.Razor.Clipboard 0.2.0

A Razor class library for interacting with the browser Clipboard API.
Use in both Server-side and Client-side Blazor apps.

There is a newer version of this package available.
See the version list below for details.
This package is considered a SemVer 2.0.0 package as it has a package dependency on SemVer 2.0.0 package(s).
This package will only be available to download with SemVer 2.0.0 compatible NuGet clients, such as Visual Studio 2017 (version 15.3) and above or NuGet client 4.3.0 and above. Read more
Install-Package CurrieTechnologies.Razor.Clipboard -Version 0.2.0
dotnet add package CurrieTechnologies.Razor.Clipboard --version 0.2.0
<PackageReference Include="CurrieTechnologies.Razor.Clipboard" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CurrieTechnologies.Razor.Clipboard --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CurrieTechnologies.Razor.Clipboard

This package provides Blazor applications with access to the browser's Clipboard API

This package is for Server-side and Client-side Blazor. CurrieTechnologies.Blazor.Clipboard is now deprecated.

Usage

  1. In your Blazor app, add the CurrieTechnologies.Razor.Clipboard NuGet package

    Install-Package CurrieTechnologies.Razor.Clipboard
    
  2. In your Blazor app's Startup.cs, register the 'ClipboardService'.

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddClipboard();
        ...
    }
    
  3. Add this script tag in your root html file (Likely _Host.cshtml for Server-side Blazor or index.html for Client-side Blazor), right under the framework script tag. (i.e &lt;script src=&quot;_framework/blazor.server.js&quot;&gt;&lt;/script&gt; for Server-side Blazor or &lt;script src=&quot;_framework/blazor.webassembly.js&quot;&gt;&lt;/script&gt; for Client-side Blazor)

    <script src="_content/CurrieTechnologies.Razor.Clipboard/clipboard.js"></script>
    
  4. Now you can inject the ClipboardService into any Blazor page and use it like this:

    @using CurrieTechnologies.Blazor.Clipboard
    @inject ClipboardService clipboard
    
    <input @bind="textValue" />
    <button @onclick="(async e => await clipboard.WriteTextAsync(textValue))">Copy To Clipboard</button>
    <button @onclick="(async e => textValue = await clipboard.ReadTextAsync())">Paste From Clipboard</button>
    
    @code
    {
        string textValue = string.Empty;
    }
    

CurrieTechnologies.Razor.Clipboard

This package provides Blazor applications with access to the browser's Clipboard API

This package is for Server-side and Client-side Blazor. CurrieTechnologies.Blazor.Clipboard is now deprecated.

Usage

  1. In your Blazor app, add the CurrieTechnologies.Razor.Clipboard NuGet package

    Install-Package CurrieTechnologies.Razor.Clipboard
    
  2. In your Blazor app's Startup.cs, register the 'ClipboardService'.

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddClipboard();
        ...
    }
    
  3. Add this script tag in your root html file (Likely _Host.cshtml for Server-side Blazor or index.html for Client-side Blazor), right under the framework script tag. (i.e &lt;script src=&quot;_framework/blazor.server.js&quot;&gt;&lt;/script&gt; for Server-side Blazor or &lt;script src=&quot;_framework/blazor.webassembly.js&quot;&gt;&lt;/script&gt; for Client-side Blazor)

    <script src="_content/CurrieTechnologies.Razor.Clipboard/clipboard.js"></script>
    
  4. Now you can inject the ClipboardService into any Blazor page and use it like this:

    @using CurrieTechnologies.Blazor.Clipboard
    @inject ClipboardService clipboard
    
    <input @bind="textValue" />
    <button @onclick="(async e => await clipboard.WriteTextAsync(textValue))">Copy To Clipboard</button>
    <button @onclick="(async e => textValue = await clipboard.ReadTextAsync())">Paste From Clipboard</button>
    
    @code
    {
        string textValue = string.Empty;
    }
    

Release Notes

Switched to .NET Standard.
   Supports Client-side and Server-side Blazor.
   Script tag update necessary

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0 54 12/3/2019
1.1.0 250 9/30/2019
1.0.0 51 9/23/2019
0.5.0 39 9/17/2019
0.4.0 42 9/5/2019
0.3.0 63 8/13/2019
0.2.0 48 7/24/2019
0.1.0 86 6/14/2019
Show less