Skip to content

Commit 9c075e9

Browse files
Transform the normal console button into a toggle one. (#676)
1 parent 8171b81 commit 9c075e9

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/base/src/commands.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,17 @@ export function addCommands(
10051005
? tracker.currentWidget.model.sharedModel.editable
10061006
: false;
10071007
},
1008-
execute: async () => await Private.toggleConsole(tracker)
1008+
isToggled: () => {
1009+
if (tracker.currentWidget instanceof JupyterGISDocumentWidget) {
1010+
return tracker.currentWidget?.content.consoleOpened === true;
1011+
} else {
1012+
return false;
1013+
}
1014+
},
1015+
execute: async () => {
1016+
await Private.toggleConsole(tracker);
1017+
commands.notifyCommandChanged(CommandIDs.toggleConsole);
1018+
}
10091019
});
10101020
commands.addCommand(CommandIDs.executeConsole, {
10111021
label: trans.__('Execute console'),

packages/base/src/widget.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export class JupyterGISPanel extends SplitPanel {
158158
return this._consoleView?.consolePanel;
159159
}
160160

161+
get consoleOpened(): boolean {
162+
return this._consoleOpened;
163+
}
164+
161165
executeConsole() {
162166
if (this._consoleView) {
163167
this._consoleView.execute();

0 commit comments

Comments
 (0)