@@ -123,8 +123,6 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
123
123
offset += - ( activeLineEle . current . offsetTop + activeLineEle . current . clientHeight / 2 ) ;
124
124
}
125
125
126
- const rawLyrics = Utils . convertParsedToLRC ( lyrics ) ;
127
-
128
126
return react . createElement (
129
127
"div" ,
130
128
{
@@ -174,6 +172,12 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
174
172
// Otherwise we should show the translated text
175
173
const lineText = originalText && showTranslatedBelow ? originalText : text ;
176
174
175
+ // Convert lyrics to text for comparison
176
+ const belowOrigin = typeof originalText === "object" ? originalText ?. props ?. children ?. [ 0 ] : originalText ;
177
+ const belowTxt = typeof text === "object" ? text ?. props ?. children ?. [ 0 ] : text ;
178
+
179
+ const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt ;
180
+
177
181
return react . createElement (
178
182
"div" ,
179
183
{
@@ -192,23 +196,32 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
192
196
Spicetify . Player . seek ( startTime ) ;
193
197
}
194
198
} ,
195
- onContextMenu : ( event ) => {
196
- event . preventDefault ( ) ;
197
- Spicetify . Platform . ClipboardAPI . copy ( rawLyrics )
198
- . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
199
- . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
200
- } ,
201
199
} ,
202
- react . createElement ( "p" , { } , ! isKara ? lineText : react . createElement ( KaraokeLine , { text, startTime, position, isActive } ) ) ,
203
- showTranslatedBelow &&
204
- originalText &&
205
- originalText !== text &&
200
+ react . createElement (
201
+ "p" ,
202
+ {
203
+ onContextMenu : ( event ) => {
204
+ event . preventDefault ( ) ;
205
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToLRC ( lyrics , belowMode ) . original )
206
+ . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
207
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
208
+ } ,
209
+ } ,
210
+ ! isKara ? lineText : react . createElement ( KaraokeLine , { text, startTime, position, isActive } )
211
+ ) ,
212
+ belowMode &&
206
213
react . createElement (
207
214
"p" ,
208
215
{
209
216
style : {
210
217
opacity : 0.5 ,
211
218
} ,
219
+ onContextMenu : ( event ) => {
220
+ event . preventDefault ( ) ;
221
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToLRC ( lyrics , belowMode ) . conver )
222
+ . then ( ( ) => Spicetify . showNotification ( "Translated lyrics copied to clipboard" ) )
223
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy translated lyrics to clipboard" ) ) ;
224
+ } ,
212
225
} ,
213
226
text
214
227
)
@@ -405,8 +418,6 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
405
418
}
406
419
}
407
420
408
- const rawLyrics = Utils . convertParsedToLRC ( lyrics ) ;
409
-
410
421
useEffect ( ( ) => {
411
422
if ( activeLineRef . current && ( ! intialScroll [ 0 ] || isInViewport ( activeLineRef . current ) ) ) {
412
423
activeLineRef . current . scrollIntoView ( {
@@ -442,6 +453,13 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
442
453
// If we have original text and we are showing translated below, we should show the original text
443
454
// Otherwise we should show the translated text
444
455
const lineText = originalText && showTranslatedBelow ? originalText : text ;
456
+
457
+ // Convert lyrics to text for comparison
458
+ const belowOrigin = typeof originalText === "object" ? originalText ?. props ?. children ?. [ 0 ] : originalText ;
459
+ const belowTxt = typeof text === "object" ? text ?. props ?. children ?. [ 0 ] : text ;
460
+
461
+ const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt ;
462
+
445
463
return react . createElement (
446
464
"div" ,
447
465
{
@@ -457,21 +475,30 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
457
475
Spicetify . Player . seek ( startTime ) ;
458
476
}
459
477
} ,
460
- onContextMenu : ( event ) => {
461
- event . preventDefault ( ) ;
462
- Spicetify . Platform . ClipboardAPI . copy ( rawLyrics )
463
- . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
464
- . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
465
- } ,
466
478
} ,
467
- react . createElement ( "p" , { } , ! isKara ? lineText : react . createElement ( KaraokeLine , { text, startTime, position, isActive } ) ) ,
468
- showTranslatedBelow &&
469
- originalText &&
470
- originalText !== text &&
479
+ react . createElement (
480
+ "p" ,
481
+ {
482
+ onContextMenu : ( event ) => {
483
+ event . preventDefault ( ) ;
484
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToLRC ( lyrics , belowMode ) . original )
485
+ . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
486
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
487
+ } ,
488
+ } ,
489
+ ! isKara ? lineText : react . createElement ( KaraokeLine , { text, startTime, position, isActive } )
490
+ ) ,
491
+ belowMode &&
471
492
react . createElement (
472
493
"p" ,
473
494
{
474
495
style : { opacity : 0.5 } ,
496
+ onContextMenu : ( event ) => {
497
+ event . preventDefault ( ) ;
498
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToLRC ( lyrics , belowMode ) . conver )
499
+ . then ( ( ) => Spicetify . showNotification ( "Translated lyrics copied to clipboard" ) )
500
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy translated lyrics to clipboard" ) ) ;
501
+ } ,
475
502
} ,
476
503
text
477
504
)
@@ -489,8 +516,6 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
489
516
} ) ;
490
517
491
518
const UnsyncedLyricsPage = react . memo ( ( { lyrics, provider, copyright } ) => {
492
- const rawLyrics = lyrics . map ( ( lyrics ) => ( typeof lyrics . text !== "object" ? lyrics . text : lyrics . text ?. props ?. children ?. [ 0 ] ) ) . join ( "\n" ) ;
493
-
494
519
return react . createElement (
495
520
"div" ,
496
521
{
@@ -505,27 +530,42 @@ const UnsyncedLyricsPage = react.memo(({ lyrics, provider, copyright }) => {
505
530
// Otherwise we should show the translated text
506
531
const lineText = originalText && showTranslatedBelow ? originalText : text ;
507
532
533
+ // Convert lyrics to text for comparison
534
+ const belowOrigin = typeof originalText === "object" ? originalText ?. props ?. children ?. [ 0 ] : originalText ;
535
+ const belowTxt = typeof text === "object" ? text ?. props ?. children ?. [ 0 ] : text ;
536
+
537
+ const belowMode = showTranslatedBelow && originalText && belowOrigin !== belowTxt ;
538
+
508
539
return react . createElement (
509
540
"div" ,
510
541
{
511
542
className : "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active" ,
512
543
key : index ,
513
544
dir : "auto" ,
514
- onContextMenu : ( event ) => {
515
- event . preventDefault ( ) ;
516
- Spicetify . Platform . ClipboardAPI . copy ( rawLyrics )
517
- . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
518
- . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
519
- } ,
520
545
} ,
521
- react . createElement ( "p" , { } , lineText ) ,
522
- showTranslatedBelow &&
523
- originalText &&
524
- originalText !== text &&
546
+ react . createElement (
547
+ "p" ,
548
+ {
549
+ onContextMenu : ( event ) => {
550
+ event . preventDefault ( ) ;
551
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToUnsynced ( lyrics , belowMode ) . original )
552
+ . then ( ( ) => Spicetify . showNotification ( "Lyrics copied to clipboard" ) )
553
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy lyrics to clipboard" ) ) ;
554
+ } ,
555
+ } ,
556
+ lineText
557
+ ) ,
558
+ belowMode &&
525
559
react . createElement (
526
560
"p" ,
527
561
{
528
562
style : { opacity : 0.5 } ,
563
+ onContextMenu : ( event ) => {
564
+ event . preventDefault ( ) ;
565
+ Spicetify . Platform . ClipboardAPI . copy ( Utils . convertParsedToUnsynced ( lyrics , belowMode ) . conver )
566
+ . then ( ( ) => Spicetify . showNotification ( "Translated lyrics copied to clipboard" ) )
567
+ . catch ( ( ) => Spicetify . showNotification ( "Failed to copy translated lyrics to clipboard" ) ) ;
568
+ } ,
529
569
} ,
530
570
text
531
571
)
0 commit comments