File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 52
52
copy . addEventListener ( 'click' , function ( ) {
53
53
var text = code . innerText . replace ( TRAILING_SPACE_RX , '' )
54
54
if ( code . dataset . lang === 'console' && text . startsWith ( '$ ' ) ) text = extractCommands ( text )
55
- var codeSample = text . slice ( 0 , 50 ) . trim ( )
56
55
writeToClipboard ( text , copy )
57
- trackCopy ( code . dataset . lang , title ?. childNodes [ 0 ] ?. nodeValue , codeSample )
56
+ trackCopy ( code . dataset . lang , title ?. childNodes [ 0 ] ?. nodeValue , text )
58
57
} )
59
58
content . prepend ( toolbox )
60
59
}
92
91
)
93
92
}
94
93
95
- function trackCopy ( language , title , sample ) {
94
+ function trackCopy ( language , title , text ) {
96
95
if ( window . analytics ) {
96
+ var sample = text . slice ( 0 , 50 ) . replace ( / \s + / g, ' ' ) . trim ( )
97
97
window . analytics . track ( 'Code Snippet Copied' , {
98
98
snippetLanguage : language ,
99
99
snippetTitle : title ,
You can’t perform that action at this time.
0 commit comments