File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,19 @@ interface HighlightErrorsProps {
10
10
label : string ;
11
11
}
12
12
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
+
13
24
const HighlightErrors : React . FC < HighlightErrorsProps > = ( { label, children } ) => (
14
- < div data-test-id = "output-stderr" >
25
+ < div data-test-id = "output-stderr" onCopy = { onOutputPrismCopy } >
15
26
< Header label = { label } />
16
27
< OutputPrism languageCode = "language-rust_errors" >
17
28
{ children }
You can’t perform that action at this time.
0 commit comments