@@ -148,7 +148,8 @@ function ScriptEditor() {
148
148
> ( [ ] ) ;
149
149
const [ scriptList , setScriptList ] = useState < Script [ ] > ( [ ] ) ;
150
150
const [ currentScript , setCurrentScript ] = useState < Script > ( ) ;
151
-
151
+ const [ selectSciptButtonAndTab , setSelectSciptButtonAndTab ] =
152
+ useState < string > ( ) ;
152
153
const setShow = ( key : visibleItem , show : boolean ) => {
153
154
Object . keys ( visible ) . forEach ( ( k ) => {
154
155
visible [ k ] = false ;
@@ -539,8 +540,11 @@ function ScriptEditor() {
539
540
overflow : "hidden" ,
540
541
textOverflow : "ellipsis" ,
541
542
whiteSpace : "nowrap" ,
543
+ backgroundColor :
544
+ selectSciptButtonAndTab === script . uuid ? "gray" : "" ,
542
545
} }
543
546
onClick = { ( ) => {
547
+ setSelectSciptButtonAndTab ( script . uuid ) ;
544
548
// 如果已经打开则激活
545
549
let flag = false ;
546
550
for ( let i = 0 ; i < editors . length ; i += 1 ) {
@@ -581,6 +585,7 @@ function ScriptEditor() {
581
585
onChange = { ( index : string ) => {
582
586
editors . forEach ( ( _ , i ) => {
583
587
if ( i . toString ( ) === index ) {
588
+ setSelectSciptButtonAndTab ( editors [ i ] . script . uuid ) ;
584
589
editors [ i ] . active = true ;
585
590
} else {
586
591
editors [ i ] . active = false ;
@@ -594,6 +599,7 @@ function ScriptEditor() {
594
599
prev . forEach ( ( item ) => {
595
600
item . active = false ;
596
601
} ) ;
602
+ setSelectSciptButtonAndTab ( e . script . uuid ) ;
597
603
prev . push ( e ) ;
598
604
return [ ...prev ] ;
599
605
} ) ;
@@ -643,8 +649,10 @@ function ScriptEditor() {
643
649
style = { {
644
650
// eslint-disable-next-line no-nested-ternary
645
651
color : e . isChanged
646
- ? "rgb(var(--orange-5))"
647
- : e . script . id === 0
652
+ ? "rgb(var(--orange-5))" // eslint-disable-next-line no-nested-ternary
653
+ : e . script . uuid === selectSciptButtonAndTab
654
+ ? "rgb(var(--green-7))"
655
+ : e . active
648
656
? "rgb(var(--green-7))"
649
657
: "var(--color-text-1)" ,
650
658
} }
0 commit comments