Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Switch back to shortcut override plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Dec 28, 2021
1 parent 37b0c2e commit 7c0b058
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
3 changes: 1 addition & 2 deletions packages/documentsearch-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"access": "public"
},
"jupyterlab": {
"extension": true,
"schemaDir": "schema"
"extension": true
},
"styleModule": "style/index.js"
}

This file was deleted.

32 changes: 30 additions & 2 deletions packages/documentsearch-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,37 @@ import {

import { ISearchProviderRegistry } from '@jupyterlab/documentsearch';

import { IRetroShell } from '@retrolab/application';
import { ISettingRegistry } from '@jupyterlab/settingregistry';

import { Widget } from '@lumino/widgets';

import { IRetroShell } from '@retrolab/application';

const SEARCHABLE_CLASS = 'jp-mod-searchable';

/**
* A plugin to programmatically disable the Crtl-F shortcut in RetroLab
* See https://github.com/jupyterlab/retrolab/pull/294 and
* https://github.com/jupyterlab/jupyterlab/issues/11754 for more context.
*/
const disableShortcut: JupyterFrontEndPlugin<void> = {
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;
docSearchShortcut.keys = [];
}
}
};

/**
* A plugin to add document search functionalities.
*/
Expand Down Expand Up @@ -59,6 +84,9 @@ const retroShellWidgetListener: JupyterFrontEndPlugin<void> = {
/**
* Export the plugins as default.
*/
const plugins: JupyterFrontEndPlugin<any>[] = [retroShellWidgetListener];
const plugins: JupyterFrontEndPlugin<any>[] = [
disableShortcut,
retroShellWidgetListener
];

export default plugins;

0 comments on commit 7c0b058

Please sign in to comment.