@jupyter-notebook/notebook-extension 7.1.0-alpha.2 → 7.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { DOMUtils, IToolbarWidgetRegistry, } from '@jupyterlab/apputils';
3
+ import { DOMUtils, IToolbarWidgetRegistry, ICommandPalette, } from '@jupyterlab/apputils';
4
4
  import { PageConfig, Text, Time, URLExt } from '@jupyterlab/coreutils';
5
5
  import { IDocumentManager } from '@jupyterlab/docmanager';
6
6
  import { IMainMenu } from '@jupyterlab/mainmenu';
@@ -31,6 +31,16 @@ const KERNEL_STATUS_FADE_OUT_CLASS = 'jp-NotebookKernelStatus-fade';
31
31
  * The class for scrolled outputs
32
32
  */
33
33
  const SCROLLED_OUTPUTS_CLASS = 'jp-mod-outputsScrolled';
34
+ /**
35
+ * The command IDs used by the notebook plugins.
36
+ */
37
+ var CommandIDs;
38
+ (function (CommandIDs) {
39
+ /**
40
+ * A command to open right sidebar for Editing Notebook Metadata
41
+ */
42
+ CommandIDs.openEditNotebookMetadata = 'notebook:edit-metadata';
43
+ })(CommandIDs || (CommandIDs = {}));
34
44
  /**
35
45
  * A plugin for the checkpoint indicator
36
46
  */
@@ -377,12 +387,59 @@ const trusted = {
377
387
  notebookShell.currentChanged.connect(onChange);
378
388
  },
379
389
  };
390
+ /**
391
+ * Add a command to open right sidebar for Editing Notebook Metadata when clicking on "Edit Notebook Metadata" under Edit menu
392
+ */
393
+ const editNotebookMetadata = {
394
+ id: '@jupyter-notebook/notebook-extension:edit-notebook-metadata',
395
+ description: 'Add a command to open right sidebar for Editing Notebook Metadata when clicking on "Edit Notebook Metadata" under Edit menu',
396
+ autoStart: true,
397
+ optional: [ICommandPalette, ITranslator, INotebookTools],
398
+ activate: (app, palette, translator, notebookTools) => {
399
+ const { commands } = app;
400
+ translator = translator !== null && translator !== void 0 ? translator : nullTranslator;
401
+ const trans = translator.load('notebook');
402
+ commands.addCommand(CommandIDs.openEditNotebookMetadata, {
403
+ label: trans.__('Edit Notebook Metadata'),
404
+ execute: async () => {
405
+ const command = 'application:toggle-panel';
406
+ const args = {
407
+ side: 'right',
408
+ title: 'Show Notebook Tools',
409
+ id: 'notebook-tools',
410
+ };
411
+ // Check if Show Notebook Tools (Right Sidebar) is open (expanded)
412
+ if (!commands.isToggled(command, args)) {
413
+ await commands.execute(command, args).then((_) => {
414
+ // For expanding the 'Advanced Tools' section (default: collapsed)
415
+ if (notebookTools) {
416
+ const tools = (notebookTools === null || notebookTools === void 0 ? void 0 : notebookTools.layout).widgets;
417
+ tools.forEach((tool) => {
418
+ if (tool.widget.title.label === trans.__('Advanced Tools') &&
419
+ tool.collapsed) {
420
+ tool.toggle();
421
+ }
422
+ });
423
+ }
424
+ });
425
+ }
426
+ },
427
+ });
428
+ if (palette) {
429
+ palette.addItem({
430
+ command: CommandIDs.openEditNotebookMetadata,
431
+ category: 'Notebook Operations',
432
+ });
433
+ }
434
+ },
435
+ };
380
436
  /**
381
437
  * Export the plugins as default.
382
438
  */
383
439
  const plugins = [
384
440
  checkpoints,
385
441
  closeTab,
442
+ editNotebookMetadata,
386
443
  kernelLogo,
387
444
  kernelStatus,
388
445
  notebookToolsWidget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/notebook-extension",
3
- "version": "7.1.0-alpha.2",
3
+ "version": "7.1.0-rc.0",
4
4
  "description": "Jupyter Notebook - Notebook Extension",
5
5
  "homepage": "https://github.com/jupyter/notebook",
6
6
  "bugs": {
@@ -38,14 +38,14 @@
38
38
  "watch": "tsc -b --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@jupyter-notebook/application": "^7.1.0-alpha.2",
42
- "@jupyterlab/application": "^4.1.0-beta.0",
43
- "@jupyterlab/apputils": "^4.2.0-beta.0",
44
- "@jupyterlab/cells": "^4.1.0-beta.0",
45
- "@jupyterlab/docmanager": "^4.1.0-beta.0",
46
- "@jupyterlab/notebook": "^4.1.0-beta.0",
47
- "@jupyterlab/settingregistry": "^4.1.0-beta.0",
48
- "@jupyterlab/translation": "^4.1.0-beta.0",
41
+ "@jupyter-notebook/application": "^7.1.0-rc.0",
42
+ "@jupyterlab/application": "^4.1.0",
43
+ "@jupyterlab/apputils": "^4.2.0",
44
+ "@jupyterlab/cells": "^4.1.0",
45
+ "@jupyterlab/docmanager": "^4.1.0",
46
+ "@jupyterlab/notebook": "^4.1.0",
47
+ "@jupyterlab/settingregistry": "^4.1.0",
48
+ "@jupyterlab/translation": "^4.1.0",
49
49
  "@lumino/polling": "^2.1.2",
50
50
  "@lumino/widgets": "^2.3.1",
51
51
  "react": "^18.2.0",
@@ -0,0 +1,28 @@
1
+ {
2
+ "title": "Jupyter Notebook Menu Entries",
3
+ "description": "Jupyter Notebook Menu Entries",
4
+ "jupyter.lab.menus": {
5
+ "main": [
6
+ {
7
+ "id": "jp-mainmenu-edit",
8
+ "items": [
9
+ {
10
+ "type": "separator",
11
+ "rank": 8.5
12
+ },
13
+ {
14
+ "command": "notebook:edit-metadata",
15
+ "rank": 8.5
16
+ },
17
+ {
18
+ "type": "separator",
19
+ "rank": 8.5
20
+ }
21
+ ]
22
+ }
23
+ ]
24
+ },
25
+ "properties": {},
26
+ "additionalProperties": false,
27
+ "type": "object"
28
+ }