CurrieTechnologies.Razor.Clipboard 0.1.0

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

There is a newer version of this package available.
See the version list below for details.
Install-Package CurrieTechnologies.Razor.Clipboard -Version 0.1.0
dotnet add package CurrieTechnologies.Razor.Clipboard --version 0.1.0
<PackageReference Include="CurrieTechnologies.Razor.Clipboard" Version="0.1.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.1.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 Blazor only. For Client-side Blazor use CurrieTechnologies.Blazor.Clipboard

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), right under the <script src="_framework/blazor.server.js"></script> tag.

    <script src="_content/currietechnologiesrazorclipboard/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 Blazor only. For Client-side Blazor use CurrieTechnologies.Blazor.Clipboard

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), right under the <script src="_framework/blazor.server.js"></script> tag.

    <script src="_content/currietechnologiesrazorclipboard/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

Initial Release

  • .NETCoreApp 3.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0 65 12/3/2019
1.1.0 250 9/30/2019
1.0.0 52 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