File tree Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Original file line number Diff line number Diff line change 53
53
}
54
54
55
55
function writeToClipboard ( code ) {
56
- var text
57
- // Check if this is a line-numbered code block (table structure)
58
- var table = code . querySelector ( 'table.hljs-ln' )
59
- if ( table ) {
60
- // Extract text only from code cells (not line number cells)
61
- var codeCells = table . querySelectorAll ( 'td.hljs-ln-code' )
62
- text = Array . prototype . slice . call ( codeCells ) . map ( function ( cell ) {
63
- return cell . textContent
64
- } ) . join ( '\n' )
65
- } else {
66
- // Fallback to original method for non-line-numbered blocks
67
- text = code . innerText
68
- }
69
- text = text . replace ( TRAILING_SPACE_RX , '' )
56
+ var text = code . innerText . replace ( TRAILING_SPACE_RX , '' )
70
57
if ( code . dataset . lang === 'console' && text . startsWith ( '$ ' ) ) text = extractCommands ( text )
71
58
window . navigator . clipboard . writeText ( text ) . then (
72
59
function ( ) {
Original file line number Diff line number Diff line change 336
336
} )
337
337
338
338
// Then, apply line numbers to highlighted blocks
339
- hljs . initLineNumbersOnLoad ( )
339
+ // hljs.initLineNumbersOnLoad() // Disabled to fix copy/paste issues
340
340
} ) ( )
You can’t perform that action at this time.
0 commit comments