diff --git a/app/package.json b/app/package.json index abbc95caf..563be058a 100644 --- a/app/package.json +++ b/app/package.json @@ -27,8 +27,8 @@ "@jupyterlab/docmanager-extension": "~3.2.0", "@jupyterlab/docprovider": "~3.2.0", "@jupyterlab/docprovider-extension": "~3.2.0", - "@jupyterlab/documentsearch": "~3.2.0", - "@jupyterlab/documentsearch-extension": "~3.2.0", + "@jupyterlab/documentsearch": "~3.2.4", + "@jupyterlab/documentsearch-extension": "~3.2.4", "@jupyterlab/filebrowser": "~3.2.0", "@jupyterlab/filebrowser-extension": "~3.2.0", "@jupyterlab/fileeditor": "~3.2.0", @@ -80,6 +80,7 @@ "@retrolab/application-extension": "~0.3.13", "@retrolab/console-extension": "~0.3.13", "@retrolab/docmanager-extension": "~0.3.13", + "@retrolab/documentsearch-extension": "~0.3.13", "@retrolab/help-extension": "~0.3.13", "@retrolab/notebook-extension": "~0.3.13", "@retrolab/terminal-extension": "~0.3.13", @@ -122,6 +123,7 @@ "@retrolab/application-extension": "^0.3.13", "@retrolab/console-extension": "^0.3.13", "@retrolab/docmanager-extension": "^0.3.13", + "@retrolab/documentsearch-extension": "^0.3.13", "@retrolab/help-extension": "^0.3.13", "@retrolab/notebook-extension": "^0.3.13", "@retrolab/terminal-extension": "^0.3.13", @@ -156,6 +158,7 @@ "@retrolab/application-extension", "@retrolab/console-extension", "@retrolab/docmanager-extension", + "@retrolab/documentsearch-extension", "@retrolab/help-extension", "@retrolab/notebook-extension", "@retrolab/terminal-extension", diff --git a/packages/documentsearch-extension/package.json b/packages/documentsearch-extension/package.json index 231a0fd47..3f9fa2fb2 100644 --- a/packages/documentsearch-extension/package.json +++ b/packages/documentsearch-extension/package.json @@ -52,7 +52,8 @@ "access": "public" }, "jupyterlab": { - "extension": true + "extension": true, + "schemaDir": "schema" }, "styleModule": "style/index.js" } diff --git a/packages/documentsearch-extension/schema/retroShellWidgetListener.json b/packages/documentsearch-extension/schema/retroShellWidgetListener.json new file mode 100644 index 000000000..ab65d1a3b --- /dev/null +++ b/packages/documentsearch-extension/schema/retroShellWidgetListener.json @@ -0,0 +1,15 @@ +{ + "title": "RetroLab DocumentSearch Settings", + "description": "RetroLab DocumentSearch Settings", + "jupyter.lab.shortcuts": [ + { + "command": "documentsearch:start", + "keys": ["Accel F"], + "selector": ".jp-mod-searchable", + "disabled": true + } + ], + "properties": {}, + "additionalProperties": false, + "type": "object" +} diff --git a/packages/documentsearch-extension/src/index.ts b/packages/documentsearch-extension/src/index.ts index 7a116efdf..c053106c1 100644 --- a/packages/documentsearch-extension/src/index.ts +++ b/packages/documentsearch-extension/src/index.ts @@ -2,14 +2,18 @@ import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'; + import { ISearchProviderRegistry } from '@jupyterlab/documentsearch'; -import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { IRetroShell } from '@retrolab/application'; + import { Widget } from '@lumino/widgets'; const SEARCHABLE_CLASS = 'jp-mod-searchable'; +/** + * A plugin to add document search functionalities. + */ const retroShellWidgetListener: JupyterFrontEndPlugin = { id: '@retrolab/documentsearch-extension:retroShellWidgetListener', requires: [IRetroShell, ISearchProviderRegistry], @@ -52,29 +56,9 @@ const retroShellWidgetListener: JupyterFrontEndPlugin = { } }; -const disableShortcut: JupyterFrontEndPlugin = { - id: '@retrolab/documentsearch-extension:disableShortcut', - requires: [ISettingRegistry], - autoStart: true, - activate: async (app: JupyterFrontEnd, registry: ISettingRegistry) => { - const docSearchShortcut = registry.plugins[ - '@jupyterlab/documentsearch-extension:plugin' - ]?.schema['jupyter.lab.shortcuts']?.find( - shortcut => shortcut.command === 'documentsearch:start' - ); - - if (docSearchShortcut) { - docSearchShortcut.disabled = true; - } - } -}; - /** * Export the plugins as default. */ -const plugins: JupyterFrontEndPlugin[] = [ - retroShellWidgetListener, - disableShortcut -]; +const plugins: JupyterFrontEndPlugin[] = [retroShellWidgetListener]; export default plugins;