MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / writeClipboardText

Function writeClipboardText

packages/app-core/src/lib/code-block-copy.ts:200–221  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

198}
199
200function writeClipboardText(text: string): boolean {
201 if (typeof window === 'undefined') return false
202
203 try {
204 const bridge = (window as Window & {
205 zen?: { clipboardWriteText?: (value: string) => void }
206 }).zen
207 if (typeof bridge?.clipboardWriteText === 'function') {
208 bridge.clipboardWriteText(text)
209 return true
210 }
211
212 if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
213 void navigator.clipboard.writeText(text)
214 return true
215 }
216 } catch {
217 return false
218 }
219
220 return false
221}
222
223function setCopyButtonFeedback(
224 button: HTMLButtonElement,

Callers 1

copyCodeBlockToClipboardFunction · 0.85

Calls 1

clipboardWriteTextMethod · 0.80

Tested by

no test coverage detected