Skip to content

Commit c41920d

Browse files
authored
cleanup
1 parent 7b83cd6 commit c41920d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

paste-html-subset.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,23 +364,22 @@ <h2>Preview</h2>
364364
}
365365
});
366366

367-
368-
copyButton.addEventListener('click', async function copyToClipboard(e) {
367+
// Copy HTML to clipboard
368+
copyButton.addEventListener('click', function() {
369369
const content = htmlOutput.value;
370370
const items = {
371371
'text/plain': new Blob([content], { type: 'text/plain' }),
372372
};
373373
if (includeRichHtmlCheckbox.checked) {
374374
items['text/html'] = new Blob([content], { type: 'text/html' });
375375
}
376-
377376
const cpItem = new ClipboardItem(items);
378377
await navigator.clipboard.write([cpItem]);
379378

380-
const originalText = e.target.textContent;
381-
e.target.textContent = 'Copied!';
379+
const originalText = copyButton.textContent;
380+
copyButton.textContent = 'Copied!';
382381
setTimeout(function() {
383-
e.target.textContent = originalText;
382+
copyButton.textContent = originalText;
384383
}, 1500);
385384
});
386385

0 commit comments

Comments
 (0)