@jupyter-notebook/documentsearch-extension 7.0.0-alpha.1 → 7.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -26
- package/package.json +9 -8
- package/schema/notebookShellWidgetListener.json +15 -0
package/lib/index.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
import { ISearchProviderRegistry } from '@jupyterlab/documentsearch';
|
|
2
|
-
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
3
2
|
import { INotebookShell } from '@jupyter-notebook/application';
|
|
4
3
|
const SEARCHABLE_CLASS = 'jp-mod-searchable';
|
|
5
|
-
/**
|
|
6
|
-
* A plugin to programmatically disable the Crtl-F shortcut in Jupyter Notebook
|
|
7
|
-
* See https://github.com/jupyterlab/retrolab/pull/294 and
|
|
8
|
-
* https://github.com/jupyterlab/jupyterlab/issues/11754 for more context.
|
|
9
|
-
*/
|
|
10
|
-
const disableShortcut = {
|
|
11
|
-
id: '@jupyter-notebook/documentsearch-extension:disableShortcut',
|
|
12
|
-
requires: [ISettingRegistry],
|
|
13
|
-
autoStart: true,
|
|
14
|
-
activate: async (app, registry) => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
const docSearchShortcut = (_b = (_a = registry.plugins['@jupyterlab/documentsearch-extension:plugin']) === null || _a === void 0 ? void 0 : _a.schema['jupyter.lab.shortcuts']) === null || _b === void 0 ? void 0 : _b.find(shortcut => shortcut.command === 'documentsearch:start');
|
|
17
|
-
if (docSearchShortcut) {
|
|
18
|
-
docSearchShortcut.disabled = true;
|
|
19
|
-
docSearchShortcut.keys = [];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
4
|
/**
|
|
24
5
|
* A plugin to add document search functionalities.
|
|
25
6
|
*/
|
|
@@ -34,11 +15,10 @@ const notebookShellWidgetListener = {
|
|
|
34
15
|
if (!widget) {
|
|
35
16
|
return;
|
|
36
17
|
}
|
|
37
|
-
|
|
38
|
-
if (providerForWidget) {
|
|
18
|
+
if (registry.hasProvider(widget)) {
|
|
39
19
|
widget.addClass(SEARCHABLE_CLASS);
|
|
40
20
|
}
|
|
41
|
-
|
|
21
|
+
else {
|
|
42
22
|
widget.removeClass(SEARCHABLE_CLASS);
|
|
43
23
|
}
|
|
44
24
|
};
|
|
@@ -59,8 +39,5 @@ const notebookShellWidgetListener = {
|
|
|
59
39
|
/**
|
|
60
40
|
* Export the plugins as default.
|
|
61
41
|
*/
|
|
62
|
-
const plugins = [
|
|
63
|
-
disableShortcut,
|
|
64
|
-
notebookShellWidgetListener
|
|
65
|
-
];
|
|
42
|
+
const plugins = [notebookShellWidgetListener];
|
|
66
43
|
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/documentsearch-extension",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.11",
|
|
4
4
|
"description": "Jupyter Notebook - Document Search Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -39,20 +39,21 @@
|
|
|
39
39
|
"watch": "tsc -b --watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jupyter-notebook/application": "^7.0.0-alpha.
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-alpha.
|
|
44
|
-
"@jupyterlab/documentsearch": "^4.0.0-alpha.
|
|
45
|
-
"@lumino/widgets": "^
|
|
42
|
+
"@jupyter-notebook/application": "^7.0.0-alpha.11",
|
|
43
|
+
"@jupyterlab/application": "^4.0.0-alpha.17",
|
|
44
|
+
"@jupyterlab/documentsearch": "^4.0.0-alpha.17",
|
|
45
|
+
"@lumino/widgets": "^2.0.0-alpha.7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"rimraf": "
|
|
49
|
-
"typescript": "~4.
|
|
48
|
+
"rimraf": "^3.0.2",
|
|
49
|
+
"typescript": "~4.9.3"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"jupyterlab": {
|
|
55
|
-
"extension": true
|
|
55
|
+
"extension": true,
|
|
56
|
+
"schemaDir": "schema"
|
|
56
57
|
},
|
|
57
58
|
"styleModule": "style/index.js"
|
|
58
59
|
}
|
|
@@ -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
|
+
}
|