Skip to content

Commit

Permalink
add labextension to gitignore
Browse files Browse the repository at this point in the history
add dep to coreutils
add token and interface IFavorites
export IFavorites

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
adriendelsalle and fcollonval committed Aug 22, 2023
1 parent 976d622 commit 10b8be2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@jupyterlab/ui-components": "^4.0.5",
"@lumino/algorithm": "^2.0.0",
"@lumino/commands": "^2.0.1",
"@lumino/coreutils": "^2.0.1",
"@lumino/signaling": "^2.0.0",
"@lumino/widgets": "^2.0.1"
},
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ import {
} from './utils';
import { PageConfig } from '@jupyterlab/coreutils';

export { IFavorites } from './token';

const TOOLBAR_CLASS = 'jp-FileBrowser-toolbar';

/**
* Initialization data for the jupyterlab-favorites extension.
*/
const favorites: JupyterFrontEndPlugin<void> = {
const favorites: JupyterFrontEndPlugin<IFavorites> = {
id: PluginIDs.favorites,
autoStart: true,
requires: [IDefaultFileBrowser, IFileBrowserFactory, ISettingRegistry],
provides: IFavorites,
optional: [IMainMenu],
activate: async (
activate: (
app: JupyterFrontEnd,
filebrowser: IDefaultFileBrowser,
factory: IFileBrowserFactory,
settingsRegistry: ISettingRegistry,
mainMenu: IMainMenu
) => {
): IFavorites => {
console.log('JupyterLab extension jupyterlab-favorites is activated!');
const docRegistry = app.docRegistry;
const layout = filebrowser.layout as PanelLayout;
Expand Down Expand Up @@ -213,6 +216,8 @@ const favorites: JupyterFrontEndPlugin<void> = {
execute: () => favoritesManager.clearFavorites(),
label: 'Clear Favorites'
});

return favoritesManager;
}
};

Expand Down
8 changes: 8 additions & 0 deletions src/token.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Token } from '@lumino/coreutils';

export namespace PluginIDs {
export const favorites = 'jupyterlab-favorites';
}
Expand Down Expand Up @@ -32,3 +34,9 @@ export namespace IFavorites {
showWidget?: boolean;
};
}

export const IFavorites = new Token<IFavorites>('jupyterlab-favorites:IFavorites');

export interface IFavorites {
readonly favorites: IFavorites.Favorite[];
}

0 comments on commit 10b8be2

Please sign in to comment.