Skip to content

Commit a78594f

Browse files
authored
feat: support onPanelToolbarClick in explorer panels (#218)
1 parent 61bf10e commit a78594f

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/controller/explorer/explorer.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,14 @@ export class ExplorerController
142142
}
143143
case EXPLORER_TOGGLE_VERTICAL: {
144144
this.emit(EditorTreeEvent.onSplitEditorLayout);
145+
break;
145146
}
146147
default:
147-
console.log('onCollapseToolbar');
148+
this.emit(
149+
ExplorerEvent.onPanelToolbarClick,
150+
parentPanel,
151+
toolbarId
152+
);
148153
}
149154
};
150155

src/model/workbench/explorer/explorer.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { localize } from 'mo/i18n/localize';
55

66
export enum ExplorerEvent {
77
onClick = 'explorer.onClick',
8+
onPanelToolbarClick = 'explorer.onPanelToolbarClick',
89
onCollapseChange = 'explorer.onCollapseChange',
910
onDeletePanel = 'explorer.onDeletePanel',
1011
}

src/services/workbench/explorer/explorerService.ts

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export interface IExplorerService extends Component<IExplorer> {
4545
* it execs when delete an explorer panel
4646
*/
4747
onDeletePanel(callback: (panel: IExplorerPanelItem) => void): void;
48+
onPanelToolbarClick(
49+
callback: (panel: IExplorerPanelItem, toolbarId: string) => void
50+
): void;
4851
}
4952

5053
@singleton()
@@ -235,4 +238,10 @@ export class ExplorerService
235238
public onDeletePanel(callback: (panel: IExplorerPanelItem) => void) {
236239
this.subscribe(ExplorerEvent.onDeletePanel, callback);
237240
}
241+
242+
public onPanelToolbarClick(
243+
callback: (panel: IExplorerPanelItem, toolbarId: string) => void
244+
) {
245+
this.subscribe(ExplorerEvent.onPanelToolbarClick, callback);
246+
}
238247
}

0 commit comments

Comments
 (0)