SystemClipboard Class
The system clipboard (https://w3c.github.io/clipboard-apis/#system-clipboard) of the browsing contexts that share a BrowsingContextOptions: the data of the copy and cut actions, of navigator.clipboard.write() and writeText(), read by the paste action, read() and readText(). The default implementation keeps the data in memory: the application can read and replace it to observe or simulate what the user copies. Override SystemClipboard.Items, SystemClipboard.ChangeCount and SystemClipboard.Write to use another clipboard (e.g. the clipboard of the operating system), and call SystemClipboard.OnChanged when it is changed by another application.
public class SystemClipboardRemarks
The names of the representations are the formats of the clipboard of Linux, ChromeOS and Android (https://w3c.github.io/clipboard-apis/#os-specific-well-known-format): the MIME types text/plain, text/html, image/png and image/svg+xml, and for the web custom formats, application/web;type="custom/formatmap" (a JSON object mapping each MIME type to its format) and application/web;type="custom/format0", application/web;type="custom/format1"... The data written by the DataTransfer of a copy event with other types is stored under these types.
Constructors
| Name | Description |
|---|---|
| SystemClipboard() |
SystemClipboard()
SystemClipboard.cspublic SystemClipboard()No documentation is available.
Properties
| Name | Description |
|---|---|
| ChangeCount | Gets the clipboard change count (https://w3c.github.io/clipboard-apis/#clipboard-change-count): a value that changes each time the data is modified. |
| Items | Gets the system clipboard items (https://w3c.github.io/clipboard-apis/#system-clipboard-data). |
ChangeCount
SystemClipboard.csItems
SystemClipboard.csGets the system clipboard items (https://w3c.github.io/clipboard-apis/#system-clipboard-data).
public virtual IReadOnlyList<SystemClipboardItem> Items { get; }Property value
Methods
| Name | Description |
|---|---|
| Clear() | Clears the clipboard. |
| OnChanged() | Raises SystemClipboard.Changed, then fires the clipboardchange events of the documents. It must be called on the thread of the event loop of the browsing contexts. |
| ReadText() | Returns the plain text of the clipboard (the first text/plain representation, decoded as UTF-8), or null when there is none. |
| Write(IReadOnlyList<SystemClipboardItem>) | Replaces the data of the clipboard, then raises SystemClipboard.Changed. An override must call SystemClipboard.OnChanged when the data changed. |
| WriteText(string) | Replaces the data of the clipboard with a plain text representation (text/plain, UTF-8 encoded). |
Clear()
SystemClipboard.csClears the clipboard.
public void Clear()OnChanged()
SystemClipboard.csRaises SystemClipboard.Changed, then fires the clipboardchange events of the documents. It must be called on the thread of the event loop of the browsing contexts.
protected void OnChanged()ReadText()
SystemClipboard.csWrite(IReadOnlyList<SystemClipboardItem>)
SystemClipboard.csReplaces the data of the clipboard, then raises SystemClipboard.Changed. An override must call SystemClipboard.OnChanged when the data changed.
public virtual void Write(IReadOnlyList<SystemClipboardItem> items)Parameters
WriteText(string)
SystemClipboard.csEvents
| Name | Description |
|---|---|
| Changed | Raised when the data of the clipboard changes (SystemClipboard.OnChanged), e.g. to fire the clipboardchange events. |
Changed
Raised when the data of the clipboard changes (SystemClipboard.OnChanged), e.g. to fire the clipboardchange events.
public event EventHandler? ChangedConstants
| Name | Description |
|---|---|
| WebCustomFormatMapName | The name of the representation of the web custom format map (https://w3c.github.io/clipboard-apis/#os-specific-custom-map-name). |
| WebCustomFormatName | The prefix of the names of the representations of the web custom formats (https://w3c.github.io/clipboard-apis/#os-specific-custom-name). |
WebCustomFormatMapName
The name of the representation of the web custom format map (https://w3c.github.io/clipboard-apis/#os-specific-custom-map-name).
public const string WebCustomFormatMapName = "application/web;type=\"custom/formatmap\""WebCustomFormatName
The prefix of the names of the representations of the web custom formats (https://w3c.github.io/clipboard-apis/#os-specific-custom-name).
public const string WebCustomFormatName = "application/web;type=\"custom/format"