Skip to content

Commit 8f3639e

Browse files
Transform the normal console button into a toggle one (#731)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 771f49b commit 8f3639e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/base/src/commands.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,13 @@ export function addCommands(
614614
? tracker.currentWidget.model.sharedModel.editable
615615
: false;
616616
},
617-
execute: async () => await Private.toggleConsole(tracker)
617+
isToggled: () => {
618+
return tracker.currentWidget?.content.consoleOpened === true;
619+
},
620+
execute: async () => {
621+
await Private.toggleConsole(tracker);
622+
commands.notifyCommandChanged(CommandIDs.toggleConsole);
623+
}
618624
});
619625
commands.addCommand(CommandIDs.executeConsole, {
620626
label: trans.__('Execute console'),

packages/base/src/widget.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ export class JupyterCadPanel extends SplitPanel {
230230
this._view.set('transform', value);
231231
}
232232

233+
get consoleOpened(): boolean {
234+
return this._consoleOpened;
235+
}
236+
233237
executeConsole() {
234238
if (this._consoleView) {
235239
this._consoleView.execute();

0 commit comments

Comments
 (0)