File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments