@@ -148,7 +148,8 @@ function ScriptEditor() {
148148 > ( [ ] ) ;
149149 const [ scriptList , setScriptList ] = useState < Script [ ] > ( [ ] ) ;
150150 const [ currentScript , setCurrentScript ] = useState < Script > ( ) ;
151-
151+ const [ selectSciptButtonAndTab , setSelectSciptButtonAndTab ] =
152+ useState < string > ( ) ;
152153 const setShow = ( key : visibleItem , show : boolean ) => {
153154 Object . keys ( visible ) . forEach ( ( k ) => {
154155 visible [ k ] = false ;
@@ -539,8 +540,11 @@ function ScriptEditor() {
539540 overflow : "hidden" ,
540541 textOverflow : "ellipsis" ,
541542 whiteSpace : "nowrap" ,
543+ backgroundColor :
544+ selectSciptButtonAndTab === script . uuid ? "gray" : "" ,
542545 } }
543546 onClick = { ( ) => {
547+ setSelectSciptButtonAndTab ( script . uuid ) ;
544548 // 如果已经打开则激活
545549 let flag = false ;
546550 for ( let i = 0 ; i < editors . length ; i += 1 ) {
@@ -581,6 +585,7 @@ function ScriptEditor() {
581585 onChange = { ( index : string ) => {
582586 editors . forEach ( ( _ , i ) => {
583587 if ( i . toString ( ) === index ) {
588+ setSelectSciptButtonAndTab ( editors [ i ] . script . uuid ) ;
584589 editors [ i ] . active = true ;
585590 } else {
586591 editors [ i ] . active = false ;
@@ -594,6 +599,7 @@ function ScriptEditor() {
594599 prev . forEach ( ( item ) => {
595600 item . active = false ;
596601 } ) ;
602+ setSelectSciptButtonAndTab ( e . script . uuid ) ;
597603 prev . push ( e ) ;
598604 return [ ...prev ] ;
599605 } ) ;
@@ -643,8 +649,10 @@ function ScriptEditor() {
643649 style = { {
644650 // eslint-disable-next-line no-nested-ternary
645651 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
648656 ? "rgb(var(--green-7))"
649657 : "var(--color-text-1)" ,
650658 } }
0 commit comments