CClipboard
Stores application clipboard data in MIME-based form.
import { CClipboard } from "canvas-toolkit-lib";Declared members
readonly changed: CSignal<[]>;Emitted when the clipboard contents change.
readonly dataChanged: CSignal<[]>;Emitted when the clipboard MIME data changes.
readonly errorOccurred: CSignal<[string]>;Reports a denied or failed system clipboard operation.
lastError(): string;canReadSystemText(): boolean;withNativeClipboard(operation: () => void): void;@internal Synchronizes a native clipboard event without writing it back.
readSystemText(): Promise<string | null>;Reads current system text. A denied read returns null, never stale cached text.
writeSystemText(text: string): Promise<boolean>;Writes text to the system clipboard; local MIME data is managed separately.
constructor(parent?: CObject | null);Creates the clipboard instance. @param parent Parent object, or `null` for no parent.
static instance(): CClipboard;Returns the current clipboard instance. @returns The current clipboard instance. @throws Error if no clipboard instance exists.
static destroy(): void;Clears the global clipboard instance reference.
mimeData(): CMimeData | null;Returns the current MIME data. @returns Clipboard MIME data, or `null` when the clipboard is empty.
setMimeData(mimeData: CMimeData | null): void;Replaces the clipboard contents with MIME data. @param mimeData MIME data to store, or `null` to clear the clipboard.
text(): string;Returns the clipboard plain text. @returns Plain text, or an empty string when no text is available.
setText(text: string): void;Replaces the clipboard contents with plain text. @param text Text to store.
clear(): void;Clears the clipboard contents.