From c1fac6d6469d156138161d753f99aa70a548b99d Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Thu, 18 Dec 2025 11:59:08 +0100 Subject: [PATCH] Add the interaction mode to the console to catch commands --- packages/console-extension/package.json | 1 + packages/console-extension/src/index.ts | 16 ++++++++++++++-- yarn.lock | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/console-extension/package.json b/packages/console-extension/package.json index b31cad1a5..c85de47f6 100644 --- a/packages/console-extension/package.json +++ b/packages/console-extension/package.json @@ -46,6 +46,7 @@ "@jupyterlab/coreutils": "~6.6.0-alpha.0", "@jupyterlab/notebook": "~4.6.0-alpha.0", "@jupyterlab/rendermime": "~4.6.0-alpha.0", + "@jupyterlab/settingregistry": "~4.6.0-alpha.0", "@jupyterlab/translation": "~4.6.0-alpha.0", "@jupyterlab/ui-components": "~4.6.0-alpha.0", "@lumino/algorithm": "^2.0.4", diff --git a/packages/console-extension/src/index.ts b/packages/console-extension/src/index.ts index 26fc95a20..bc6f373dd 100644 --- a/packages/console-extension/src/index.ts +++ b/packages/console-extension/src/index.ts @@ -25,6 +25,8 @@ import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import { ITranslator, nullTranslator } from '@jupyterlab/translation'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { consoleIcon } from '@jupyterlab/ui-components'; import { @@ -123,7 +125,7 @@ const scratchPadConsole: JupyterFrontEndPlugin = { IRenderMimeRegistry, INotebookTracker, ], - optional: [INotebookShell, ICommandPalette, ITranslator], + optional: [INotebookShell, ICommandPalette, ITranslator, ISettingRegistry], autoStart: true, description: 'Open consoles in a new tab', activate: ( @@ -135,7 +137,8 @@ const scratchPadConsole: JupyterFrontEndPlugin = { tracker: INotebookTracker, notebookShell: INotebookShell | null, palette: ICommandPalette | null, - translator: ITranslator | null + translator: ITranslator | null, + settingRegistry: ISettingRegistry | null ) => { const { commands } = app; const manager = app.serviceManager; @@ -191,6 +194,15 @@ const scratchPadConsole: JupyterFrontEndPlugin = { panel.title.caption = trans.__('Console'); panel.id = consoleId; + const interactionMode: string = (( + await settingRegistry?.get( + '@jupyterlab/console-extension:tracker', + 'interactionMode' + ) + )?.composite ?? 'notebook') as string; + (panel as ConsolePanel).console.node.dataset.jpInteractionMode = + interactionMode; + notebookShell.add(panel, 'right'); } diff --git a/yarn.lock b/yarn.lock index 703e692ff..76332d601 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2389,6 +2389,7 @@ __metadata: "@jupyterlab/coreutils": ~6.6.0-alpha.0 "@jupyterlab/notebook": ~4.6.0-alpha.0 "@jupyterlab/rendermime": ~4.6.0-alpha.0 + "@jupyterlab/settingregistry": ~4.6.0-alpha.0 "@jupyterlab/translation": ~4.6.0-alpha.0 "@jupyterlab/ui-components": ~4.6.0-alpha.0 "@lumino/algorithm": ^2.0.4