Skip to content

Commit a45a951

Browse files
committed
Remove custom plugin to disable the shortcut
1 parent 60faa5a commit a45a951

File tree

3 files changed

+18
-30
lines changed

3 files changed

+18
-30
lines changed

packages/documentsearch-extension/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"access": "public"
5353
},
5454
"jupyterlab": {
55-
"extension": true
55+
"extension": true,
56+
"schemaDir": "schema"
5657
},
5758
"styleModule": "style/index.js"
5859
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"title": "Jupyter Notebook DocumentSearch Settings",
3+
"description": "Jupyter Notebook DocumentSearch Settings",
4+
"jupyter.lab.shortcuts": [
5+
{
6+
"command": "documentsearch:start",
7+
"keys": ["Accel F"],
8+
"selector": ".jp-mod-searchable",
9+
"disabled": true
10+
}
11+
],
12+
"properties": {},
13+
"additionalProperties": false,
14+
"type": "object"
15+
}

packages/documentsearch-extension/src/index.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,12 @@ import {
55

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

8-
import { ISettingRegistry } from '@jupyterlab/settingregistry';
9-
108
import { Widget } from '@lumino/widgets';
119

1210
import { INotebookShell } from '@jupyter-notebook/application';
1311

1412
const SEARCHABLE_CLASS = 'jp-mod-searchable';
1513

16-
/**
17-
* A plugin to programmatically disable the Crtl-F shortcut in Jupyter Notebook
18-
* See https://github.com/jupyterlab/retrolab/pull/294 and
19-
* https://github.com/jupyterlab/jupyterlab/issues/11754 for more context.
20-
*/
21-
const disableShortcut: JupyterFrontEndPlugin<void> = {
22-
id: '@jupyter-notebook/documentsearch-extension:disableShortcut',
23-
requires: [ISettingRegistry],
24-
autoStart: true,
25-
activate: async (app: JupyterFrontEnd, registry: ISettingRegistry) => {
26-
const docSearchShortcut = registry.plugins[
27-
'@jupyterlab/documentsearch-extension:plugin'
28-
]?.schema['jupyter.lab.shortcuts']?.find(
29-
shortcut => shortcut.command === 'documentsearch:start'
30-
);
31-
32-
if (docSearchShortcut) {
33-
docSearchShortcut.disabled = true;
34-
docSearchShortcut.keys = [];
35-
}
36-
}
37-
};
38-
3914
/**
4015
* A plugin to add document search functionalities.
4116
*/
@@ -84,9 +59,6 @@ const notebookShellWidgetListener: JupyterFrontEndPlugin<void> = {
8459
/**
8560
* Export the plugins as default.
8661
*/
87-
const plugins: JupyterFrontEndPlugin<any>[] = [
88-
disableShortcut,
89-
notebookShellWidgetListener
90-
];
62+
const plugins: JupyterFrontEndPlugin<any>[] = [notebookShellWidgetListener];
9163

9264
export default plugins;

0 commit comments

Comments
 (0)