Skip to content

Latest commit

 

History

History
109 lines (54 loc) · 2.67 KB

readme.source.md

File metadata and controls

109 lines (54 loc) · 2.67 KB

TextCopy

  • AppVeyor: Build status
  • TravisCI: Build status
  • NuGet Status

A cross platform package to copy text to and from the clipboard.

Support is available via a Tidelift Subscription.

toc

NuGet package

https://nuget.org/packages/TextCopy/

Usage

SetTextAsync

snippet: SetTextAsync

SetText

snippet: SetText

GetTextAsync

snippet: GetTextAsync

GetText

snippet: GetText

Clearing The Clipboard

snippet: ClearClipboard

snippet: ClearClipboardAsync

Instance API

In addition to the above static API, there is an instance API exposed:

snippet: SetTextInstance

Dependency Injection

An instance of Clipboard can be injected into IServiceCollection:

snippet: InjectClipboard

The instance should be injected by using IClipboard.

There is also a InjectMockClipboard that injects an instance of MockClipboard with all methods stubbed out.

Supported on

  • Windows with .NET Framework 4.6.1 and up
  • Windows with .NET Core 2.0 and up
  • Windows with Mono 5.0 and up
  • OSX with .NET Core 2.0 and up
  • OSX with Mono 5.20.1 and up
  • Linux with .NET Core 2.0 and up
  • Linux with Mono 5.20.1 and up
  • Xamarin.Android 9.0 and up
  • Xamarin.iOS 10.0 and up
  • Universal Windows Platform version 10.0.16299 and up
  • Blazor WebAssembly

Blazor WebAssembly

Due to the dependency on JSInterop the static ClipboardService is not supported on Blazor.

Instead inject an IClipboard:

snippet: BlazorStartup

Then consume it:

snippet: Inject

Blazor support requires the browser APIs clipboard.readText and clipboard.writeText.

Linux

Linux uses xclip to access the clipboard. As such it needs to be installed and callable.

Security contact information

To report a security vulnerability, use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Icon

Clone designed by Wes Breazell from The Noun Project.