@jupyter-notebook/help-extension 7.0.0-alpha.8 → 7.0.0-beta.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.d.ts +2 -5
- package/lib/index.js +83 -51
- package/package.json +9 -8
- /package/schema/{plugin.json → open.json} +0 -0
package/lib/index.d.ts
CHANGED
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 { showDialog, Dialog } from '@jupyterlab/apputils';
|
|
3
|
+
import { showDialog, Dialog, ICommandPalette } from '@jupyterlab/apputils';
|
|
4
4
|
import { IMainMenu } from '@jupyterlab/mainmenu';
|
|
5
5
|
import { ITranslator } from '@jupyterlab/translation';
|
|
6
6
|
import { jupyterIcon } from '@jupyter-notebook/ui-components';
|
|
@@ -11,12 +11,12 @@ import * as React from 'react';
|
|
|
11
11
|
const RESOURCES = [
|
|
12
12
|
{
|
|
13
13
|
text: 'About Jupyter',
|
|
14
|
-
url: 'https://jupyter.org'
|
|
14
|
+
url: 'https://jupyter.org',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
text: 'Markdown Reference',
|
|
18
|
-
url: 'https://commonmark.org/help/'
|
|
19
|
-
}
|
|
18
|
+
url: 'https://commonmark.org/help/',
|
|
19
|
+
},
|
|
20
20
|
];
|
|
21
21
|
/**
|
|
22
22
|
* The command IDs used by the help plugin.
|
|
@@ -28,51 +28,34 @@ var CommandIDs;
|
|
|
28
28
|
CommandIDs.about = 'help:about';
|
|
29
29
|
})(CommandIDs || (CommandIDs = {}));
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* A plugin to open the about section with resources.
|
|
32
32
|
*/
|
|
33
|
-
const
|
|
34
|
-
id: '@jupyter-notebook/help-extension:
|
|
33
|
+
const open = {
|
|
34
|
+
id: '@jupyter-notebook/help-extension:open',
|
|
35
35
|
autoStart: true,
|
|
36
|
-
|
|
37
|
-
optional: [IMainMenu],
|
|
38
|
-
activate: (app, translator, menu) => {
|
|
36
|
+
activate: (app) => {
|
|
39
37
|
const { commands } = app;
|
|
40
|
-
const trans = translator.load('notebook');
|
|
41
38
|
commands.addCommand(CommandIDs.open, {
|
|
42
|
-
label: args => args['text'],
|
|
43
|
-
execute: args => {
|
|
39
|
+
label: (args) => args['text'],
|
|
40
|
+
execute: (args) => {
|
|
44
41
|
const url = args['url'];
|
|
45
42
|
window.open(url);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
commands.addCommand(CommandIDs.shortcuts, {
|
|
49
|
-
label: trans.__('Keyboard Shortcuts'),
|
|
50
|
-
execute: () => {
|
|
51
|
-
const title = (React.createElement("span", { className: "jp-AboutNotebook-about-header" },
|
|
52
|
-
React.createElement("div", { className: "jp-AboutNotebook-about-header-info" }, trans.__('Keyboard Shortcuts'))));
|
|
53
|
-
const body = (React.createElement("table", { className: "jp-AboutNotebook-shortcuts" },
|
|
54
|
-
React.createElement("thead", null,
|
|
55
|
-
React.createElement("tr", null,
|
|
56
|
-
React.createElement("th", null, trans.__('Name')),
|
|
57
|
-
React.createElement("th", null, trans.__('Shortcut')))),
|
|
58
|
-
React.createElement("tbody", null, commands.keyBindings
|
|
59
|
-
.filter(binding => commands.isEnabled(binding.command))
|
|
60
|
-
.map((binding, i) => (React.createElement("tr", { key: i },
|
|
61
|
-
React.createElement("td", null, commands.label(binding.command)),
|
|
62
|
-
React.createElement("td", null,
|
|
63
|
-
React.createElement("pre", null, binding.keys.join(', ')))))))));
|
|
64
|
-
return showDialog({
|
|
65
|
-
title,
|
|
66
|
-
body,
|
|
67
|
-
buttons: [
|
|
68
|
-
Dialog.createButton({
|
|
69
|
-
label: trans.__('Dismiss'),
|
|
70
|
-
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled'
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
43
|
+
},
|
|
75
44
|
});
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Plugin to add a command to show an About Jupyter Notebook and Markdown Reference.
|
|
49
|
+
*/
|
|
50
|
+
const about = {
|
|
51
|
+
id: '@jupyter-notebook/help-extension:about',
|
|
52
|
+
autoStart: true,
|
|
53
|
+
requires: [ITranslator],
|
|
54
|
+
optional: [IMainMenu, ICommandPalette],
|
|
55
|
+
activate: (app, translator, menu, palette) => {
|
|
56
|
+
const { commands } = app;
|
|
57
|
+
const trans = translator.load('notebook');
|
|
58
|
+
const category = trans.__('Help');
|
|
76
59
|
commands.addCommand(CommandIDs.about, {
|
|
77
60
|
label: trans.__('About %1', app.name),
|
|
78
61
|
execute: () => {
|
|
@@ -87,7 +70,7 @@ const plugin = {
|
|
|
87
70
|
React.createElement("a", { href: notebookURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, aboutJupyter),
|
|
88
71
|
React.createElement("a", { href: contributorURL, target: "_blank", rel: "noopener noreferrer", className: "jp-Button-flat jp-AboutNotebook-about-externalLinks" }, contributorList)));
|
|
89
72
|
const version = trans.__('Version: %1', app.version);
|
|
90
|
-
const copyright = trans.__('© 2021-
|
|
73
|
+
const copyright = trans.__('© 2021-2023 Jupyter Notebook Contributors');
|
|
91
74
|
const body = (React.createElement(React.Fragment, null,
|
|
92
75
|
React.createElement("span", { className: "jp-AboutNotebook-version" }, version),
|
|
93
76
|
React.createElement("div", null, externalLinks),
|
|
@@ -98,21 +81,70 @@ const plugin = {
|
|
|
98
81
|
buttons: [
|
|
99
82
|
Dialog.createButton({
|
|
100
83
|
label: trans.__('Dismiss'),
|
|
101
|
-
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled'
|
|
102
|
-
})
|
|
103
|
-
]
|
|
84
|
+
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled',
|
|
85
|
+
}),
|
|
86
|
+
],
|
|
104
87
|
});
|
|
105
88
|
dialog.addClass('jp-AboutNotebook');
|
|
106
89
|
void dialog.launch();
|
|
107
|
-
}
|
|
90
|
+
},
|
|
108
91
|
});
|
|
109
|
-
|
|
92
|
+
if (palette) {
|
|
93
|
+
palette.addItem({ command: CommandIDs.about, category });
|
|
94
|
+
}
|
|
95
|
+
const resourcesGroup = RESOURCES.map((args) => ({
|
|
110
96
|
args,
|
|
111
|
-
command: CommandIDs.open
|
|
97
|
+
command: CommandIDs.open,
|
|
112
98
|
}));
|
|
113
99
|
if (menu) {
|
|
114
100
|
menu.helpMenu.addGroup(resourcesGroup, 30);
|
|
115
101
|
}
|
|
116
|
-
}
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* A plugin to add a command to display Keyboard Shortcuts.
|
|
106
|
+
*/
|
|
107
|
+
const shortcuts = {
|
|
108
|
+
id: '@jupyter-notebook/help-extension:shortcuts',
|
|
109
|
+
autoStart: true,
|
|
110
|
+
requires: [ITranslator],
|
|
111
|
+
optional: [ICommandPalette],
|
|
112
|
+
activate: (app, translator, palette) => {
|
|
113
|
+
const { commands } = app;
|
|
114
|
+
const trans = translator.load('notebook');
|
|
115
|
+
const category = trans.__('Help');
|
|
116
|
+
commands.addCommand(CommandIDs.shortcuts, {
|
|
117
|
+
label: trans.__('Keyboard Shortcuts'),
|
|
118
|
+
execute: () => {
|
|
119
|
+
const title = (React.createElement("span", { className: "jp-AboutNotebook-about-header" },
|
|
120
|
+
React.createElement("div", { className: "jp-AboutNotebook-about-header-info" }, trans.__('Keyboard Shortcuts'))));
|
|
121
|
+
const body = (React.createElement("table", { className: "jp-AboutNotebook-shortcuts" },
|
|
122
|
+
React.createElement("thead", null,
|
|
123
|
+
React.createElement("tr", null,
|
|
124
|
+
React.createElement("th", null, trans.__('Name')),
|
|
125
|
+
React.createElement("th", null, trans.__('Shortcut')))),
|
|
126
|
+
React.createElement("tbody", null, commands.keyBindings
|
|
127
|
+
.filter((binding) => commands.isEnabled(binding.command))
|
|
128
|
+
.map((binding, i) => (React.createElement("tr", { key: i },
|
|
129
|
+
React.createElement("td", null, commands.label(binding.command)),
|
|
130
|
+
React.createElement("td", null,
|
|
131
|
+
React.createElement("pre", null, binding.keys.join(', ')))))))));
|
|
132
|
+
return showDialog({
|
|
133
|
+
title,
|
|
134
|
+
body,
|
|
135
|
+
buttons: [
|
|
136
|
+
Dialog.createButton({
|
|
137
|
+
label: trans.__('Dismiss'),
|
|
138
|
+
className: 'jp-AboutNotebook-about-button jp-mod-reject jp-mod-styled',
|
|
139
|
+
}),
|
|
140
|
+
],
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
if (palette) {
|
|
145
|
+
palette.addItem({ command: CommandIDs.shortcuts, category });
|
|
146
|
+
}
|
|
147
|
+
},
|
|
117
148
|
};
|
|
118
|
-
|
|
149
|
+
const plugins = [open, shortcuts, about];
|
|
150
|
+
export default plugins;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/help-extension",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"description": "Jupyter Notebook - Help Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyter/notebook",
|
|
6
6
|
"bugs": {
|
|
@@ -35,19 +35,20 @@
|
|
|
35
35
|
"build:prod": "tsc -b",
|
|
36
36
|
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
|
37
37
|
"docs": "typedoc src",
|
|
38
|
-
"prepublishOnly": "npm run build",
|
|
39
38
|
"watch": "tsc -b --watch"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@jupyter-notebook/ui-components": "^7.0.0-
|
|
43
|
-
"@jupyterlab/application": "^4.0.0-
|
|
44
|
-
"@jupyterlab/apputils": "^4.0.0-
|
|
45
|
-
"@jupyterlab/mainmenu": "^4.0.0-
|
|
46
|
-
"@jupyterlab/translation": "^4.0.0-
|
|
41
|
+
"@jupyter-notebook/ui-components": "^7.0.0-beta.0",
|
|
42
|
+
"@jupyterlab/application": "^4.0.0-beta.0",
|
|
43
|
+
"@jupyterlab/apputils": "^4.0.0-beta.0",
|
|
44
|
+
"@jupyterlab/mainmenu": "^4.0.0-beta.0",
|
|
45
|
+
"@jupyterlab/translation": "^4.0.0-beta.0",
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"react-dom": "^18.2.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"rimraf": "^3.0.2",
|
|
50
|
-
"typescript": "~
|
|
51
|
+
"typescript": "~5.0.2"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
|
File without changes
|