@jupyter-notebook/notebook-extension 7.3.0-beta.0 → 7.3.0-beta.2

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
@@ -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
  */
@@ -266,6 +336,7 @@ const scrollOutput = {
266
336
  const autoScroll = (cell) => {
267
337
  if (!autoScrollOutputs) {
268
338
  // bail if disabled via the settings
339
+ cell.removeClass(SCROLLED_OUTPUTS_CLASS);
269
340
  return;
270
341
  }
271
342
  const { outputArea } = cell;
@@ -466,6 +537,7 @@ const plugins = [
466
537
  closeTab,
467
538
  openTreeTab,
468
539
  editNotebookMetadata,
540
+ fullWidthNotebook,
469
541
  kernelLogo,
470
542
  kernelStatus,
471
543
  notebookToolsWidget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-notebook/notebook-extension",
3
- "version": "7.3.0-beta.0",
3
+ "version": "7.3.0-beta.2",
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.0",
42
- "@jupyterlab/application": "~4.3.0-rc.0",
43
- "@jupyterlab/apputils": "~4.4.0-rc.0",
44
- "@jupyterlab/cells": "~4.3.0-rc.0",
45
- "@jupyterlab/docmanager": "~4.3.0-rc.0",
46
- "@jupyterlab/notebook": "~4.3.0-rc.0",
47
- "@jupyterlab/settingregistry": "~4.3.0-rc.0",
48
- "@jupyterlab/translation": "~4.3.0-rc.0",
41
+ "@jupyter-notebook/application": "^7.3.0-beta.2",
42
+ "@jupyterlab/application": "~4.3.0",
43
+ "@jupyterlab/apputils": "~4.4.0",
44
+ "@jupyterlab/cells": "~4.3.0",
45
+ "@jupyterlab/docmanager": "~4.3.0",
46
+ "@jupyterlab/notebook": "~4.3.0",
47
+ "@jupyterlab/settingregistry": "~4.3.0",
48
+ "@jupyterlab/translation": "~4.3.0",
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 {