Skip to content

Commit e68609d

Browse files
authored
Add 'New JupyterGIS file' option to context menu (#800)
* Add 'New JupyterGIS file' option to context menu * lint * Apply suggestions from code review * update test
1 parent c168955 commit e68609d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

python/jupytergis_core/src/jgisplugin/plugins.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const activate = async (
151151
});
152152

153153
app.commands.addCommand(CommandIDs.createNew, {
154-
label: args => 'GIS File',
154+
label: args => (args['label'] as string) ?? 'GIS Project',
155155
caption: 'Create a new JGIS Editor',
156156
icon: args => logoIcon,
157157
execute: async args => {
@@ -238,6 +238,14 @@ const activate = async (
238238
});
239239
}
240240
}
241+
242+
// Inject “New JupyterGIS file” into the File Browser context menu
243+
app.contextMenu.addItem({
244+
command: CommandIDs.createNew,
245+
selector: '.jp-DirListing',
246+
rank: 55,
247+
args: { label: 'New JupyterGIS Project' },
248+
});
241249
};
242250

243251
const jGISPlugin: JupyterFrontEndPlugin<void> = {

ui-tests/tests/new-file.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test.describe('#newFile', () => {
66
});
77

88
test('New file should open with no errors', async ({ page }) => {
9-
await page.getByLabel('notebook content').getByText('GIS File').click();
9+
await page.getByLabel('notebook content').getByText('GIS Project').click();
1010

1111
const tab = page.getByLabel('notebook content');
1212
const layers = page.getByText('Layers', { exact: true });

0 commit comments

Comments
 (0)