electron/docs/fiddles/system/clipboard/copy/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

10 lines
345 B
JavaScript

const { clipboard } = require('electron')
const copyBtn = document.getElementById('copy-to')
const copyInput = document.getElementById('copy-to-input')
copyBtn.addEventListener('click', () => {
if (copyInput.value !== '') copyInput.value = ''
copyInput.placeholder = 'Copied! Paste here to see.'
clipboard.writeText('Electron Demo!')
})