mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-07 13:07:22 +08:00
Switch back to shortcut override plugin
This commit is contained in:
parent
37b0c2e41f
commit
7c0b058372
@ -52,8 +52,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"jupyterlab": {
|
||||
"extension": true,
|
||||
"schemaDir": "schema"
|
||||
"extension": true
|
||||
},
|
||||
"styleModule": "style/index.js"
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
@ -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.
|
||||
*/
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user