Copies text to the clipboard, preferring a rich ClipboardItem write so
text/html formatting is preserved. Resolves to true on success.
navigator.clipboard.write() requires the clipboard-sanitized-write
permission, which some embedded environments deny (notably the Electron
desktop app, where it surfaced as an unhandled NotAllowedError). When the
rich write is rejected we fall back to writeText, which is not
permission-gated — formatting is lost but the copy still lands. Success side
effects (the onCopy callback and the "copied" state) only fire once a write
actually succeeds, so callers never show a false confirmation.
Copies
textto the clipboard, preferring a richClipboardItemwrite sotext/htmlformatting is preserved. Resolves totrueon success.navigator.clipboard.write()requires theclipboard-sanitized-writepermission, which some embedded environments deny (notably the Electron desktop app, where it surfaced as an unhandledNotAllowedError). When the rich write is rejected we fall back towriteText, which is not permission-gated — formatting is lost but the copy still lands. Success side effects (theonCopycallback and the "copied" state) only fire once a write actually succeeds, so callers never show a false confirmation.