File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,19 @@ interface HighlightErrorsProps {
1010 label : string ;
1111}
1212
13+ const onOutputPrismCopy : React . ClipboardEventHandler = event => {
14+ // Blank out HTML copy data.
15+ // Though linkified output is handy in the Playground, it does more harm
16+ // than good when copied elsewhere, and terminal output is usable on its own.
17+ const selection = document . getSelection ( ) ;
18+ if ( selection ) {
19+ event . clipboardData . setData ( 'text/plain' , selection . toString ( ) ) ;
20+ event . preventDefault ( ) ;
21+ }
22+ } ;
23+
1324const HighlightErrors : React . FC < HighlightErrorsProps > = ( { label, children } ) => (
14- < div data-test-id = "output-stderr" >
25+ < div data-test-id = "output-stderr" onCopy = { onOutputPrismCopy } >
1526 < Header label = { label } />
1627 < OutputPrism languageCode = "language-rust_errors" >
1728 { children }
You can’t perform that action at this time.
0 commit comments