View as Markdown

API reference: @salmonui/chat/smart-paste

SmartPasteinterface

import type { SmartPaste } from '@salmonui/chat/smart-paste';
interface SmartPaste {
    readonly paste: (text?: string) => Promise<SmartPasteResult>;
    readonly pending: boolean;
}
SmartPaste members (2)
NameSignatureDescription
pastereadonly paste: (text?: string) => Promise<SmartPasteResult>;

Without an argument reads navigator.clipboard.readText() (call it from the click handler, inside the user gesture); with text uses that text. Rejects with the adapter's error, the clipboard error, or an AbortError when a newer paste or unmount aborted it.

pendingreadonly pending: boolean;

True while a paste waits for the clipboard or the adapter.