@@ -71,8 +71,6 @@ export class OscdLayout extends LitElement {
71
71
@property ( { type : String } ) docName = '' ;
72
72
/** Index of the last [[`EditorAction`]] applied. */
73
73
@property ( { type : Number } ) editCount = - 1 ;
74
- /** The currently active editor tab. */
75
- @property ( { type : Number } ) activeTab = 0 ;
76
74
77
75
/** The plugins to render the layout. */
78
76
@property ( { type : Array } ) plugins : Plugin [ ] = [ ] ;
@@ -490,22 +488,13 @@ export class OscdLayout extends LitElement {
490
488
this . activeEditor = e . detail . editor
491
489
}
492
490
493
- private handleActivatedEditorTabByUser ( e : CustomEvent ) : void {
494
- const tabIndex = e . detail . index ;
495
- this . activateTab ( tabIndex ) ;
496
- }
497
-
498
491
private handleActivateEditorByEvent ( e : CustomEvent < { name : string , src : string } > ) : void {
499
492
const { name, src} = e . detail ;
500
493
const editors = this . calcActiveEditors ( )
501
- const wantedEditorIndex = editors . findIndex ( editor => editor . name === name || editor . src === src )
502
- if ( wantedEditorIndex < 0 ) { return ; } // TODO: log error
503
-
504
- this . activateTab ( wantedEditorIndex ) ;
505
- }
494
+ const wantedEditor = editors . find ( editor => editor . name === name || editor . src === src )
495
+ if ( ! wantedEditor ) { return ; } // TODO: log error
506
496
507
- private activateTab ( index : number ) {
508
- this . activeTab = index ;
497
+ this . activeEditor = wantedEditor ;
509
498
}
510
499
511
500
private handleRunMenuByEvent ( e : CustomEvent < { name : string } > ) : void {
0 commit comments