Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to the menu #57

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
"@jupyterlab/docmanager": "^4.2.5",
"@jupyterlab/filebrowser": "^4.2.5",
"@jupyterlab/services": "^7.2.5",
"@jupyterlab/settingregistry": "^4.2.5"
"@jupyterlab/settingregistry": "^4.2.5",
"@jupyterlab/translation": "^4.2.5"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
Expand Down
17 changes: 17 additions & 0 deletions schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@
"default": false
}
},
"jupyter.lab.menus": {
"main": [
{
"id": "jp-mainmenu-view",
"items": [
{
"command": "quickopen:activate",
"rank": 1
},
{
"type": "separator",
"rank": 1
}
]
}
]
},
"jupyter.lab.shortcuts": [
{
"command": "quickopen:activate",
Expand Down
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
import { ServerConnection } from '@jupyterlab/services';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { FileBrowser, IDefaultFileBrowser } from '@jupyterlab/filebrowser';
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
import { CommandRegistry } from '@lumino/commands';
import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
import { Message } from '@lumino/messaging';
Expand Down Expand Up @@ -128,20 +129,17 @@ class QuickOpenWidget extends CommandPalette {
const extension: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-quickopen:plugin',
autoStart: true,
requires: [
ICommandPalette,
IDocumentManager,
ISettingRegistry,
IDefaultFileBrowser
],
requires: [IDocumentManager, ISettingRegistry, IDefaultFileBrowser],
optional: [ICommandPalette, ITranslator],
activate: async (
app: JupyterFrontEnd,
palette: ICommandPalette,
docManager: IDocumentManager,
settingRegistry: ISettingRegistry,
defaultFileBrowser: IDefaultFileBrowser
defaultFileBrowser: IDefaultFileBrowser,
palette: ICommandPalette | null,
translator: ITranslator | null
) => {
console.log(`Activated extension: ${extension.id}`);
const trans = (translator ?? nullTranslator).load('jupyterlab-quickopen');
const commands: CommandRegistry = new CommandRegistry();
const settings: ISettingRegistry.ISettings = await settingRegistry.load(
extension.id
Expand Down Expand Up @@ -173,12 +171,14 @@ const extension: JupyterFrontEndPlugin<void> = {
// palette, assign a hotkey, etc.
const command = 'quickopen:activate';
app.commands.addCommand(command, {
label: 'Quick Open',
label: trans.__('Quick Open'),
execute: () => {
modalPalette.activate();
}
});
palette.addItem({ command, category: 'File Operations' });
if (palette) {
palette.addItem({ command, category: 'File Operations' });
}
}
};

Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,7 @@ __metadata:
"@jupyterlab/filebrowser": ^4.2.5
"@jupyterlab/services": ^7.2.5
"@jupyterlab/settingregistry": ^4.2.5
"@jupyterlab/translation": ^4.2.5
"@types/json-schema": ^7.0.11
"@types/react": ^18.0.26
"@types/react-addons-linked-state-mixin": ^0.14.22
Expand Down
Loading