electron/docs/fiddles/system/clipboard/paste/renderer.js
Rik Theunis ec87917f58 docs: add clipboard Fiddle examples (#20445)
* docs: add clipboard paste Fiddle example

* docs: add clipboard copy Fiddle example

* docs: add appropriate title to Fiddles

Co-Authored-By: John Kleinschmidt <jkleinsc@github.com>
2019-10-10 09:48:33 -04:00

9 lines
305 B
JavaScript

const { clipboard } = require('electron')
const pasteBtn = document.getElementById('paste-to')
pasteBtn.addEventListener('click', () => {
clipboard.writeText('What a demo!')
const message = `Clipboard contents: ${clipboard.readText()}`
document.getElementById('paste-from').innerHTML = message
})