@jupyter-notebook/notebook-extension 7.3.0-beta.0 → 7.3.0-beta.1
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 +71 -0
- package/package.json +9 -9
- package/schema/full-width-notebook.json +27 -0
- package/style/base.css +10 -0
package/lib/index.js
CHANGED
|
@@ -31,6 +31,10 @@ 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 class for the full width notebook
|
|
36
|
+
*/
|
|
37
|
+
const FULL_WIDTH_NOTEBOOK_CLASS = 'jp-mod-fullwidth';
|
|
34
38
|
/**
|
|
35
39
|
* The command IDs used by the notebook plugins.
|
|
36
40
|
*/
|
|
@@ -40,6 +44,10 @@ var CommandIDs;
|
|
|
40
44
|
* A command to open right sidebar for Editing Notebook Metadata
|
|
41
45
|
*/
|
|
42
46
|
CommandIDs.openEditNotebookMetadata = 'notebook:edit-metadata';
|
|
47
|
+
/**
|
|
48
|
+
* A command to toggle full width of the notebook
|
|
49
|
+
*/
|
|
50
|
+
CommandIDs.toggleFullWidth = 'notebook:toggle-full-width';
|
|
43
51
|
})(CommandIDs || (CommandIDs = {}));
|
|
44
52
|
/**
|
|
45
53
|
* A plugin for the checkpoint indicator
|
|
@@ -143,6 +151,68 @@ const openTreeTab = {
|
|
|
143
151
|
});
|
|
144
152
|
},
|
|
145
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* A plugin to set the notebook to full width.
|
|
156
|
+
*/
|
|
157
|
+
const fullWidthNotebook = {
|
|
158
|
+
id: '@jupyter-notebook/notebook-extension:full-width-notebook',
|
|
159
|
+
description: 'A plugin to set the notebook to full width.',
|
|
160
|
+
autoStart: true,
|
|
161
|
+
requires: [INotebookTracker],
|
|
162
|
+
optional: [ICommandPalette, ISettingRegistry, ITranslator],
|
|
163
|
+
activate: (app, tracker, palette, settingRegistry, translator) => {
|
|
164
|
+
const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('notebook');
|
|
165
|
+
let fullWidth = false;
|
|
166
|
+
const toggleFullWidth = () => {
|
|
167
|
+
const current = tracker.currentWidget;
|
|
168
|
+
fullWidth = !fullWidth;
|
|
169
|
+
if (!current) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const content = current;
|
|
173
|
+
content.toggleClass(FULL_WIDTH_NOTEBOOK_CLASS, fullWidth);
|
|
174
|
+
};
|
|
175
|
+
let notebookSettings;
|
|
176
|
+
if (settingRegistry) {
|
|
177
|
+
const loadSettings = settingRegistry.load(fullWidthNotebook.id);
|
|
178
|
+
const updateSettings = (settings) => {
|
|
179
|
+
const newFullWidth = settings.get('fullWidthNotebook')
|
|
180
|
+
.composite;
|
|
181
|
+
if (newFullWidth !== fullWidth) {
|
|
182
|
+
toggleFullWidth();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
Promise.all([loadSettings, app.restored])
|
|
186
|
+
.then(([settings]) => {
|
|
187
|
+
notebookSettings = settings;
|
|
188
|
+
updateSettings(settings);
|
|
189
|
+
settings.changed.connect((settings) => {
|
|
190
|
+
updateSettings(settings);
|
|
191
|
+
});
|
|
192
|
+
})
|
|
193
|
+
.catch((reason) => {
|
|
194
|
+
console.error(reason.message);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
app.commands.addCommand(CommandIDs.toggleFullWidth, {
|
|
198
|
+
label: trans.__('Enable Full Width Notebook'),
|
|
199
|
+
execute: () => {
|
|
200
|
+
toggleFullWidth();
|
|
201
|
+
if (notebookSettings) {
|
|
202
|
+
notebookSettings.set('fullWidthNotebook', fullWidth);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
isEnabled: () => tracker.currentWidget !== null,
|
|
206
|
+
isToggled: () => fullWidth,
|
|
207
|
+
});
|
|
208
|
+
if (palette) {
|
|
209
|
+
palette.addItem({
|
|
210
|
+
command: CommandIDs.toggleFullWidth,
|
|
211
|
+
category: 'Notebook Operations',
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
};
|
|
146
216
|
/**
|
|
147
217
|
* The kernel logo plugin.
|
|
148
218
|
*/
|
|
@@ -466,6 +536,7 @@ const plugins = [
|
|
|
466
536
|
closeTab,
|
|
467
537
|
openTreeTab,
|
|
468
538
|
editNotebookMetadata,
|
|
539
|
+
fullWidthNotebook,
|
|
469
540
|
kernelLogo,
|
|
470
541
|
kernelStatus,
|
|
471
542
|
notebookToolsWidget,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyter-notebook/notebook-extension",
|
|
3
|
-
"version": "7.3.0-beta.
|
|
3
|
+
"version": "7.3.0-beta.1",
|
|
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.3.0-beta.
|
|
42
|
-
"@jupyterlab/application": "~4.3.0-rc.
|
|
43
|
-
"@jupyterlab/apputils": "~4.4.0-rc.
|
|
44
|
-
"@jupyterlab/cells": "~4.3.0-rc.
|
|
45
|
-
"@jupyterlab/docmanager": "~4.3.0-rc.
|
|
46
|
-
"@jupyterlab/notebook": "~4.3.0-rc.
|
|
47
|
-
"@jupyterlab/settingregistry": "~4.3.0-rc.
|
|
48
|
-
"@jupyterlab/translation": "~4.3.0-rc.
|
|
41
|
+
"@jupyter-notebook/application": "^7.3.0-beta.1",
|
|
42
|
+
"@jupyterlab/application": "~4.3.0-rc.1",
|
|
43
|
+
"@jupyterlab/apputils": "~4.4.0-rc.1",
|
|
44
|
+
"@jupyterlab/cells": "~4.3.0-rc.1",
|
|
45
|
+
"@jupyterlab/docmanager": "~4.3.0-rc.1",
|
|
46
|
+
"@jupyterlab/notebook": "~4.3.0-rc.1",
|
|
47
|
+
"@jupyterlab/settingregistry": "~4.3.0-rc.1",
|
|
48
|
+
"@jupyterlab/translation": "~4.3.0-rc.1",
|
|
49
49
|
"@lumino/polling": "^2.1.3",
|
|
50
50
|
"@lumino/widgets": "^2.5.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Jupyter Notebook Full Width Notebook",
|
|
3
|
+
"description": "Jupyter Notebook Notebook With settings",
|
|
4
|
+
"jupyter.lab.menus": {
|
|
5
|
+
"main": [
|
|
6
|
+
{
|
|
7
|
+
"id": "jp-mainmenu-view",
|
|
8
|
+
"items": [
|
|
9
|
+
{
|
|
10
|
+
"command": "notebook:toggle-full-width",
|
|
11
|
+
"rank": 4
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"properties": {
|
|
18
|
+
"fullWidthNotebook": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"title": "Full Width Notebook",
|
|
21
|
+
"description": "Whether to the notebook should take up the full width of the application",
|
|
22
|
+
"default": false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"type": "object"
|
|
27
|
+
}
|
package/style/base.css
CHANGED
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
- compact view on mobile
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
/* Make the notebook take up the full width of the page when jp-mod-fullwidth is set */
|
|
20
|
+
|
|
21
|
+
body[data-notebook='notebooks']
|
|
22
|
+
.jp-NotebookPanel.jp-mod-fullwidth
|
|
23
|
+
.jp-WindowedPanel-outer {
|
|
24
|
+
padding-left: unset;
|
|
25
|
+
padding-right: unset !important;
|
|
26
|
+
width: unset;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
/* Keep the notebook centered on the page */
|
|
20
30
|
|
|
21
31
|
body[data-notebook='notebooks'] .jp-NotebookPanel-toolbar {
|