У меня есть некоторый опыт настройки Jupyter Notebook, но не с JupyterLab.
По сути, я хочу добавить подмножество команд на боковую вкладку.Допустим, я зарегистрировал команду «sample» под заголовком «DTLA»
function addCommands(app: JupyterLab, tracker: ICommandPalette): void {
const category = 'DTLA';
let command = CommandIDs.sample;
app.commands.addCommand(command, {
label: 'sample',
execute: () => { console.log('hellow!'); }
});
tracker.addItem({ command, category })
}
/**
* The command IDs used by the application plugin.
*/
namespace CommandIDs {
export
const sample: string = 'application:sample';
}
https://imgur.com/pHlTCLZ
, теперь я хочу поместить ее на собственную вкладку боковой панели,который я могу создать просто отлично.
/**
* Activate the extension.
*/
function activateext(
app: JupyterLab,
docmanager: IDocumentManager,
editorTracker: IEditorTracker,
restorer: ILayoutRestorer,
notebookTracker: INotebookTracker,
rendermime: IRenderMimeRegistry,
palette: ICommandPalette,
): IExt {
// Create the ext widget.
const ext = new Ext({docmanager, rendermime, palette});
// Create the ext registry.
const registry = new ExtRegistry();
//add commands
addCommands(app, palette);
// Add the ext to the left area.
ext.title.label = 'DTLA';
ext.id = 'table-of-contents';
app.shell.addToLeftArea(ext, {rank: 700});
// Add the ext widget to the application restorer.
restorer.add(ext, 'juputerlab-ext');
return registry;
}
export default extension;
https://imgur.com/a/bQhZNOe
Итак, как мне прикрепить команды к новой боковой панели?