mirror of
https://github.com/jupyter/notebook.git
synced 2024-11-21 01:11:21 +08:00
Switch to declarative keyboard shortcuts
This commit is contained in:
parent
38a6166b23
commit
55915e63e8
@ -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",
|
||||
|
@ -52,7 +52,8 @@
|
||||
"access": "public"
|
||||
},
|
||||
"jupyterlab": {
|
||||
"extension": true
|
||||
"extension": true,
|
||||
"schemaDir": "schema"
|
||||
},
|
||||
"styleModule": "style/index.js"
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
@ -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<void> = {
|
||||
id: '@retrolab/documentsearch-extension:retroShellWidgetListener',
|
||||
requires: [IRetroShell, ISearchProviderRegistry],
|
||||
@ -52,29 +56,9 @@ const retroShellWidgetListener: JupyterFrontEndPlugin<void> = {
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Export the plugins as default.
|
||||
*/
|
||||
const plugins: JupyterFrontEndPlugin<any>[] = [
|
||||
retroShellWidgetListener,
|
||||
disableShortcut
|
||||
];
|
||||
const plugins: JupyterFrontEndPlugin<any>[] = [retroShellWidgetListener];
|
||||
|
||||
export default plugins;
|
||||
|
Loading…
Reference in New Issue
Block a user