@jupyterlab/notebook 4.6.2 → 4.7.0-alpha.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/actions.js +63 -5
- package/lib/actions.js.map +1 -1
- package/lib/panel.js +0 -3
- package/lib/panel.js.map +1 -1
- package/lib/searchprovider.js +0 -1
- package/lib/searchprovider.js.map +1 -1
- package/lib/widget.d.ts +10 -0
- package/lib/widget.js +41 -6
- package/lib/widget.js.map +1 -1
- package/lib/widgetfactory.d.ts +6 -0
- package/lib/widgetfactory.js +3 -4
- package/lib/widgetfactory.js.map +1 -1
- package/package.json +33 -32
- package/src/actions.tsx +78 -5
- package/src/panel.ts +1 -3
- package/src/searchprovider.ts +1 -3
- package/src/widget.ts +57 -8
- package/src/widgetfactory.ts +10 -3
- package/style/index.css +1 -0
- package/style/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/notebook",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0-alpha.1",
|
|
4
4
|
"description": "JupyterLab - Notebook",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -41,40 +41,41 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@jupyter/ydoc": "^4.0.0",
|
|
44
|
-
"@jupyterlab/apputils": "^4.
|
|
45
|
-
"@jupyterlab/cells": "^4.
|
|
46
|
-
"@jupyterlab/codeeditor": "^4.
|
|
47
|
-
"@jupyterlab/codemirror": "^4.
|
|
48
|
-
"@jupyterlab/coreutils": "^6.
|
|
49
|
-
"@jupyterlab/docregistry": "^4.
|
|
50
|
-
"@jupyterlab/documentsearch": "^4.
|
|
51
|
-
"@jupyterlab/lsp": "^4.
|
|
52
|
-
"@jupyterlab/markedparser-extension": "^4.
|
|
53
|
-
"@jupyterlab/nbformat": "^4.
|
|
54
|
-
"@jupyterlab/observables": "^5.
|
|
55
|
-
"@jupyterlab/
|
|
56
|
-
"@jupyterlab/
|
|
57
|
-
"@jupyterlab/
|
|
58
|
-
"@jupyterlab/
|
|
59
|
-
"@jupyterlab/
|
|
60
|
-
"@jupyterlab/
|
|
61
|
-
"@jupyterlab/
|
|
62
|
-
"@
|
|
63
|
-
"@lumino/
|
|
64
|
-
"@lumino/
|
|
65
|
-
"@lumino/
|
|
66
|
-
"@lumino/
|
|
67
|
-
"@lumino/
|
|
68
|
-
"@lumino/
|
|
69
|
-
"@lumino/
|
|
70
|
-
"@lumino/
|
|
71
|
-
"@lumino/
|
|
72
|
-
"@lumino/
|
|
73
|
-
"@lumino/
|
|
44
|
+
"@jupyterlab/apputils": "^4.8.0-alpha.1",
|
|
45
|
+
"@jupyterlab/cells": "^4.7.0-alpha.1",
|
|
46
|
+
"@jupyterlab/codeeditor": "^4.7.0-alpha.1",
|
|
47
|
+
"@jupyterlab/codemirror": "^4.7.0-alpha.1",
|
|
48
|
+
"@jupyterlab/coreutils": "^6.7.0-alpha.1",
|
|
49
|
+
"@jupyterlab/docregistry": "^4.7.0-alpha.1",
|
|
50
|
+
"@jupyterlab/documentsearch": "^4.7.0-alpha.1",
|
|
51
|
+
"@jupyterlab/lsp": "^4.7.0-alpha.1",
|
|
52
|
+
"@jupyterlab/markedparser-extension": "^4.7.0-alpha.1",
|
|
53
|
+
"@jupyterlab/nbformat": "^4.7.0-alpha.1",
|
|
54
|
+
"@jupyterlab/observables": "^5.7.0-alpha.1",
|
|
55
|
+
"@jupyterlab/outputarea": "^4.7.0-alpha.1",
|
|
56
|
+
"@jupyterlab/rendermime": "^4.7.0-alpha.1",
|
|
57
|
+
"@jupyterlab/services": "^7.7.0-alpha.1",
|
|
58
|
+
"@jupyterlab/settingregistry": "^4.7.0-alpha.1",
|
|
59
|
+
"@jupyterlab/statusbar": "^4.7.0-alpha.1",
|
|
60
|
+
"@jupyterlab/toc": "^6.7.0-alpha.1",
|
|
61
|
+
"@jupyterlab/translation": "^4.7.0-alpha.1",
|
|
62
|
+
"@jupyterlab/ui-components": "^4.7.0-alpha.1",
|
|
63
|
+
"@lumino/algorithm": "^2.0.5",
|
|
64
|
+
"@lumino/commands": "^2.3.4",
|
|
65
|
+
"@lumino/coreutils": "^2.2.3",
|
|
66
|
+
"@lumino/disposable": "^2.1.6",
|
|
67
|
+
"@lumino/domutils": "^2.0.5",
|
|
68
|
+
"@lumino/dragdrop": "^2.1.9",
|
|
69
|
+
"@lumino/messaging": "^2.0.5",
|
|
70
|
+
"@lumino/polling": "^2.1.6",
|
|
71
|
+
"@lumino/properties": "^2.0.5",
|
|
72
|
+
"@lumino/signaling": "^2.1.6",
|
|
73
|
+
"@lumino/virtualdom": "^2.0.5",
|
|
74
|
+
"@lumino/widgets": "^2.9.0",
|
|
74
75
|
"react": "^18.2.0"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
|
-
"@jupyterlab/testing": "^4.
|
|
78
|
+
"@jupyterlab/testing": "^4.7.0-alpha.1",
|
|
78
79
|
"@types/jest": "^29.2.0",
|
|
79
80
|
"jest": "^29.2.0",
|
|
80
81
|
"rimraf": "~5.0.5",
|
package/src/actions.tsx
CHANGED
|
@@ -1592,6 +1592,19 @@ export namespace NotebookActions {
|
|
|
1592
1592
|
switch (mode) {
|
|
1593
1593
|
case 'below':
|
|
1594
1594
|
index = notebook.activeCellIndex + 1;
|
|
1595
|
+
// If the active cell is a collapsed markdown heading with children,
|
|
1596
|
+
// insert after all the children, not just after the heading.
|
|
1597
|
+
{
|
|
1598
|
+
const activeCell = notebook.activeCell;
|
|
1599
|
+
if (
|
|
1600
|
+
activeCell instanceof MarkdownCell &&
|
|
1601
|
+
activeCell.headingCollapsed &&
|
|
1602
|
+
activeCell.numberChildNodes > 0
|
|
1603
|
+
) {
|
|
1604
|
+
index =
|
|
1605
|
+
notebook.activeCellIndex + activeCell.numberChildNodes + 1;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1595
1608
|
break;
|
|
1596
1609
|
case 'belowSelected':
|
|
1597
1610
|
notebook.widgets.forEach((child, childIndex) => {
|
|
@@ -1599,7 +1612,24 @@ export namespace NotebookActions {
|
|
|
1599
1612
|
index = childIndex + 1;
|
|
1600
1613
|
}
|
|
1601
1614
|
});
|
|
1602
|
-
|
|
1615
|
+
// If the last selected cell is a collapsed markdown heading with children,
|
|
1616
|
+
// insert after all the children, not just after the heading.
|
|
1617
|
+
{
|
|
1618
|
+
const lastSelectedIndex = index - 1;
|
|
1619
|
+
if (
|
|
1620
|
+
lastSelectedIndex >= 0 &&
|
|
1621
|
+
lastSelectedIndex < notebook.widgets.length
|
|
1622
|
+
) {
|
|
1623
|
+
const widget = notebook.widgets[lastSelectedIndex];
|
|
1624
|
+
if (
|
|
1625
|
+
widget instanceof MarkdownCell &&
|
|
1626
|
+
widget.headingCollapsed &&
|
|
1627
|
+
widget.numberChildNodes > 0
|
|
1628
|
+
) {
|
|
1629
|
+
index = lastSelectedIndex + widget.numberChildNodes + 1;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1603
1633
|
break;
|
|
1604
1634
|
case 'above':
|
|
1605
1635
|
index = notebook.activeCellIndex;
|
|
@@ -3071,8 +3101,30 @@ namespace Private {
|
|
|
3071
3101
|
* @returns A list of 0 or more selected cells
|
|
3072
3102
|
*/
|
|
3073
3103
|
export function selectedCells(notebook: Notebook): nbformat.ICell[] {
|
|
3074
|
-
|
|
3075
|
-
|
|
3104
|
+
const cellsToInclude = new Set<Cell>();
|
|
3105
|
+
|
|
3106
|
+
// Collect all selected/active cells and expand collapsed sections
|
|
3107
|
+
for (let i = 0; i < notebook.widgets.length; i++) {
|
|
3108
|
+
const cell = notebook.widgets[i];
|
|
3109
|
+
if (notebook.isSelectedOrActive(cell)) {
|
|
3110
|
+
cellsToInclude.add(cell);
|
|
3111
|
+
|
|
3112
|
+
// If this is a collapsed markdown cell, add all its children
|
|
3113
|
+
if (
|
|
3114
|
+
cell instanceof MarkdownCell &&
|
|
3115
|
+
cell.headingCollapsed &&
|
|
3116
|
+
cell.numberChildNodes > 0
|
|
3117
|
+
) {
|
|
3118
|
+
for (let j = i + 1; j <= i + cell.numberChildNodes; j++) {
|
|
3119
|
+
if (notebook.widgets[j]) {
|
|
3120
|
+
cellsToInclude.add(notebook.widgets[j]);
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
return Array.from(cellsToInclude)
|
|
3076
3128
|
.map(cell => cell.model.toJSON())
|
|
3077
3129
|
.map(cellJSON => {
|
|
3078
3130
|
if ((cellJSON.metadata as JSONObject).deletable !== undefined) {
|
|
@@ -3279,19 +3331,40 @@ namespace Private {
|
|
|
3279
3331
|
const model = notebook.model!;
|
|
3280
3332
|
const sharedModel = model.sharedModel;
|
|
3281
3333
|
const toDelete: number[] = [];
|
|
3334
|
+
const cellsToDeleteSet = new Set<number>();
|
|
3282
3335
|
|
|
3283
3336
|
notebook.mode = 'command';
|
|
3284
3337
|
|
|
3285
|
-
// Find the cells to delete.
|
|
3338
|
+
// Find the cells to delete, expanding collapsed sections.
|
|
3286
3339
|
notebook.widgets.forEach((child, index) => {
|
|
3287
3340
|
const deletable = child.model.getMetadata('deletable') !== false;
|
|
3288
3341
|
|
|
3289
3342
|
if (notebook.isSelectedOrActive(child) && deletable) {
|
|
3290
|
-
|
|
3343
|
+
cellsToDeleteSet.add(index);
|
|
3291
3344
|
notebook.model?.deletedCells.push(child.model.id);
|
|
3345
|
+
|
|
3346
|
+
// If this is a collapsed markdown cell, mark all its children for deletion
|
|
3347
|
+
if (
|
|
3348
|
+
child instanceof MarkdownCell &&
|
|
3349
|
+
child.headingCollapsed &&
|
|
3350
|
+
child.numberChildNodes > 0
|
|
3351
|
+
) {
|
|
3352
|
+
for (let j = index + 1; j <= index + child.numberChildNodes; j++) {
|
|
3353
|
+
if (notebook.widgets[j]) {
|
|
3354
|
+
const childDeletable =
|
|
3355
|
+
notebook.widgets[j].model.getMetadata('deletable') !== false;
|
|
3356
|
+
if (childDeletable) {
|
|
3357
|
+
cellsToDeleteSet.add(j);
|
|
3358
|
+
notebook.model?.deletedCells.push(notebook.widgets[j].model.id);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3292
3363
|
}
|
|
3293
3364
|
});
|
|
3294
3365
|
|
|
3366
|
+
toDelete.push(...Array.from(cellsToDeleteSet).sort((a, b) => a - b));
|
|
3367
|
+
|
|
3295
3368
|
// If cells are not deletable, we may not have anything to delete.
|
|
3296
3369
|
if (toDelete.length > 0) {
|
|
3297
3370
|
// Detach futures before the transaction so dispose() does not cancel them.
|
package/src/panel.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
|
|
5
3
|
import type { ISessionContext } from '@jupyterlab/apputils';
|
|
6
4
|
import { Dialog, Printing, showDialog } from '@jupyterlab/apputils';
|
|
7
5
|
import { isMarkdownCellModel } from '@jupyterlab/cells';
|
|
@@ -191,7 +189,7 @@ export class NotebookPanel extends DocumentWidget<Notebook, INotebookModel> {
|
|
|
191
189
|
* Handle a change in the kernel by updating the document metadata.
|
|
192
190
|
*/
|
|
193
191
|
private _onKernelChanged(
|
|
194
|
-
sender:
|
|
192
|
+
sender: ISessionContext,
|
|
195
193
|
args: Session.ISessionConnection.IKernelChangedArgs
|
|
196
194
|
): void {
|
|
197
195
|
if (!this.model || !args.newValue) {
|
package/src/searchprovider.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
|
|
5
3
|
import { Dialog, showDialog } from '@jupyterlab/apputils';
|
|
6
4
|
import type {
|
|
7
5
|
CellSearchProvider,
|
|
@@ -66,7 +64,7 @@ export class NotebookSearchProvider extends SearchProvider<NotebookPanel> {
|
|
|
66
64
|
this._filtersChanged.connect(this._setEnginesSelectionSearchMode, this);
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
private _onNotebookStateChanged(_: Notebook, args: IChangedArgs<
|
|
67
|
+
private _onNotebookStateChanged(_: Notebook, args: IChangedArgs<unknown>) {
|
|
70
68
|
if (args.name === 'mode') {
|
|
71
69
|
// Delay the update to ensure that `document.activeElement` settled.
|
|
72
70
|
window.setTimeout(() => {
|
package/src/widget.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
|
|
|
15
15
|
import type { IChangedArgs } from '@jupyterlab/coreutils';
|
|
16
16
|
import type * as nbformat from '@jupyterlab/nbformat';
|
|
17
17
|
import type { IObservableList } from '@jupyterlab/observables';
|
|
18
|
+
import type { IPageHandler } from '@jupyterlab/outputarea';
|
|
18
19
|
import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
19
20
|
import type { IMapChange } from '@jupyter/ydoc';
|
|
20
21
|
import { TableOfContentsUtils } from '@jupyterlab/toc';
|
|
@@ -245,6 +246,7 @@ export class StaticNotebook extends WindowedList<NotebookViewModel> {
|
|
|
245
246
|
this.notebookConfig =
|
|
246
247
|
options.notebookConfig || StaticNotebook.defaultNotebookConfig;
|
|
247
248
|
this._updateNotebookConfig();
|
|
249
|
+
this._pageHandler = options.pageHandler;
|
|
248
250
|
this._mimetypeService = options.mimeTypeService;
|
|
249
251
|
this.renderingLayout = options.notebookConfig?.renderingLayout;
|
|
250
252
|
this.kernelHistory = options.kernelHistory;
|
|
@@ -729,6 +731,7 @@ export class StaticNotebook extends WindowedList<NotebookViewModel> {
|
|
|
729
731
|
maxNumberOutputs: this.notebookConfig.maxNumberOutputs,
|
|
730
732
|
model,
|
|
731
733
|
placeholder: this._notebookConfig.windowingMode !== 'none',
|
|
734
|
+
pageHandler: this._pageHandler,
|
|
732
735
|
rendermime,
|
|
733
736
|
translator: this.translator
|
|
734
737
|
};
|
|
@@ -1222,6 +1225,7 @@ export class StaticNotebook extends WindowedList<NotebookViewModel> {
|
|
|
1222
1225
|
private _renderingLayout: RenderingLayout | undefined;
|
|
1223
1226
|
private _renderingLayoutChanged = new Signal<this, RenderingLayout>(this);
|
|
1224
1227
|
private _contentVisibilityObserver: IntersectionObserver | null = null;
|
|
1228
|
+
private _pageHandler: IPageHandler | undefined;
|
|
1225
1229
|
}
|
|
1226
1230
|
|
|
1227
1231
|
/**
|
|
@@ -1276,6 +1280,11 @@ export namespace StaticNotebook {
|
|
|
1276
1280
|
* The renderer used by the underlying windowed list.
|
|
1277
1281
|
*/
|
|
1278
1282
|
renderer?: WindowedList.IRenderer;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Optional handler for pager payloads (`source: page`).
|
|
1286
|
+
*/
|
|
1287
|
+
pageHandler?: IPageHandler;
|
|
1279
1288
|
}
|
|
1280
1289
|
|
|
1281
1290
|
/**
|
|
@@ -1991,6 +2000,7 @@ export class Notebook extends StaticNotebook {
|
|
|
1991
2000
|
}
|
|
1992
2001
|
|
|
1993
2002
|
this._ensureFocus();
|
|
2003
|
+
|
|
1994
2004
|
if (newValue === oldValue) {
|
|
1995
2005
|
return;
|
|
1996
2006
|
}
|
|
@@ -2085,16 +2095,25 @@ export class Notebook extends StaticNotebook {
|
|
|
2085
2095
|
if (newActiveCellIndex >= 0) {
|
|
2086
2096
|
this.activeCellIndex = newActiveCellIndex;
|
|
2087
2097
|
}
|
|
2098
|
+
|
|
2099
|
+
// Deselect all cells first to clear any stale selection state.
|
|
2100
|
+
this.deselectAll();
|
|
2088
2101
|
if (from > to) {
|
|
2089
2102
|
isSelected.forEach((selected, idx) => {
|
|
2090
2103
|
if (selected) {
|
|
2091
|
-
this.
|
|
2104
|
+
const widget = this.widgets[to + idx];
|
|
2105
|
+
if (widget) {
|
|
2106
|
+
this.select(widget);
|
|
2107
|
+
}
|
|
2092
2108
|
}
|
|
2093
2109
|
});
|
|
2094
2110
|
} else {
|
|
2095
2111
|
isSelected.forEach((selected, idx) => {
|
|
2096
2112
|
if (selected) {
|
|
2097
|
-
this.
|
|
2113
|
+
const widget = this.widgets[to - n + 1 + idx];
|
|
2114
|
+
if (widget) {
|
|
2115
|
+
this.select(widget);
|
|
2116
|
+
}
|
|
2098
2117
|
}
|
|
2099
2118
|
});
|
|
2100
2119
|
}
|
|
@@ -2112,6 +2131,7 @@ export class Notebook extends StaticNotebook {
|
|
|
2112
2131
|
return;
|
|
2113
2132
|
}
|
|
2114
2133
|
Private.selectedProperty.set(widget, true);
|
|
2134
|
+
this._selectCollapsedSection(widget);
|
|
2115
2135
|
this._selectionChanged.emit(void 0);
|
|
2116
2136
|
this.update();
|
|
2117
2137
|
}
|
|
@@ -2127,6 +2147,19 @@ export class Notebook extends StaticNotebook {
|
|
|
2127
2147
|
if (!Private.selectedProperty.get(widget)) {
|
|
2128
2148
|
return;
|
|
2129
2149
|
}
|
|
2150
|
+
// Deselect all children if widget is a collapsed heading
|
|
2151
|
+
if (
|
|
2152
|
+
widget instanceof MarkdownCell &&
|
|
2153
|
+
widget.headingCollapsed &&
|
|
2154
|
+
widget.numberChildNodes > 0
|
|
2155
|
+
) {
|
|
2156
|
+
const idx = this.widgets.indexOf(widget);
|
|
2157
|
+
for (let i = idx + 1; i <= idx + widget.numberChildNodes; i++) {
|
|
2158
|
+
if (this.widgets[i]) {
|
|
2159
|
+
Private.selectedProperty.set(this.widgets[i], false);
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2130
2163
|
Private.selectedProperty.set(widget, false);
|
|
2131
2164
|
this._selectionChanged.emit(void 0);
|
|
2132
2165
|
this.update();
|
|
@@ -2162,11 +2195,8 @@ export class Notebook extends StaticNotebook {
|
|
|
2162
2195
|
}
|
|
2163
2196
|
if (changed) {
|
|
2164
2197
|
this._selectionChanged.emit(void 0);
|
|
2198
|
+
this.update();
|
|
2165
2199
|
}
|
|
2166
|
-
// Make sure we have a valid active cell.
|
|
2167
|
-
// eslint-disable-next-line no-self-assign
|
|
2168
|
-
this.activeCellIndex = this.activeCellIndex;
|
|
2169
|
-
this.update();
|
|
2170
2200
|
}
|
|
2171
2201
|
|
|
2172
2202
|
/**
|
|
@@ -2264,6 +2294,25 @@ export class Notebook extends StaticNotebook {
|
|
|
2264
2294
|
}
|
|
2265
2295
|
}
|
|
2266
2296
|
|
|
2297
|
+
/**
|
|
2298
|
+
* Select all child cells of a collapsed heading, if applicable.
|
|
2299
|
+
*/
|
|
2300
|
+
private _selectCollapsedSection(cell: Cell | null): void {
|
|
2301
|
+
if (
|
|
2302
|
+
cell instanceof MarkdownCell &&
|
|
2303
|
+
cell.headingCollapsed &&
|
|
2304
|
+
cell.numberChildNodes > 0
|
|
2305
|
+
) {
|
|
2306
|
+
const idx = this.widgets.indexOf(cell);
|
|
2307
|
+
for (let i = idx; i <= idx + cell.numberChildNodes; i++) {
|
|
2308
|
+
if (this.widgets[i]) {
|
|
2309
|
+
Private.selectedProperty.set(this.widgets[i], true);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
this._selectionChanged.emit(void 0);
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2267
2316
|
/**
|
|
2268
2317
|
* Get the head and anchor of a contiguous cell selection.
|
|
2269
2318
|
*
|
|
@@ -2962,9 +3011,9 @@ export class Notebook extends StaticNotebook {
|
|
|
2962
3011
|
(this.rendermime.sanitizer.allowNamedProperties ?? false)
|
|
2963
3012
|
? 'id'
|
|
2964
3013
|
: 'data-jupyter-id';
|
|
2965
|
-
const element = this.node.querySelector(
|
|
3014
|
+
const element = this.node.querySelector<HTMLElement>(
|
|
2966
3015
|
`h${heading.level}[${attribute}="${CSS.escape(id)}"]`
|
|
2967
|
-
)
|
|
3016
|
+
)!;
|
|
2968
3017
|
|
|
2969
3018
|
return {
|
|
2970
3019
|
cell,
|
package/src/widgetfactory.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
|
|
5
3
|
import type { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
|
|
6
4
|
import type { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
7
5
|
import { ABCWidgetFactory } from '@jupyterlab/docregistry';
|
|
6
|
+
import type { IPageHandler } from '@jupyterlab/outputarea';
|
|
8
7
|
import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
9
8
|
import type { ITranslator } from '@jupyterlab/translation';
|
|
10
9
|
import type { INotebookModel } from './model';
|
|
@@ -33,6 +32,7 @@ export class NotebookWidgetFactory extends ABCWidgetFactory<
|
|
|
33
32
|
options.editorConfig || StaticNotebook.defaultEditorConfig;
|
|
34
33
|
this._notebookConfig =
|
|
35
34
|
options.notebookConfig || StaticNotebook.defaultNotebookConfig;
|
|
35
|
+
this._pageHandler = options.pageHandler;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/*
|
|
@@ -80,7 +80,7 @@ export class NotebookWidgetFactory extends ABCWidgetFactory<
|
|
|
80
80
|
context: DocumentRegistry.IContext<INotebookModel>,
|
|
81
81
|
source?: NotebookPanel
|
|
82
82
|
): NotebookPanel {
|
|
83
|
-
const translator =
|
|
83
|
+
const translator = this.translator;
|
|
84
84
|
const kernelHistory = new NotebookHistory({
|
|
85
85
|
sessionContext: context.sessionContext,
|
|
86
86
|
translator: translator
|
|
@@ -95,6 +95,7 @@ export class NotebookWidgetFactory extends ABCWidgetFactory<
|
|
|
95
95
|
notebookConfig: source
|
|
96
96
|
? source.content.notebookConfig
|
|
97
97
|
: this._notebookConfig,
|
|
98
|
+
pageHandler: this._pageHandler,
|
|
98
99
|
translator,
|
|
99
100
|
kernelHistory
|
|
100
101
|
};
|
|
@@ -105,6 +106,7 @@ export class NotebookWidgetFactory extends ABCWidgetFactory<
|
|
|
105
106
|
|
|
106
107
|
private _editorConfig: StaticNotebook.IEditorConfig;
|
|
107
108
|
private _notebookConfig: StaticNotebook.INotebookConfig;
|
|
109
|
+
private _pageHandler: IPageHandler | undefined;
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
@@ -142,6 +144,11 @@ export namespace NotebookWidgetFactory {
|
|
|
142
144
|
*/
|
|
143
145
|
notebookConfig?: StaticNotebook.INotebookConfig;
|
|
144
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Optional handler for pager payloads (`source: page`).
|
|
149
|
+
*/
|
|
150
|
+
pageHandler?: IPageHandler;
|
|
151
|
+
|
|
145
152
|
/**
|
|
146
153
|
* The application language translator.
|
|
147
154
|
*/
|
package/style/index.css
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
@import url('~@jupyterlab/documentsearch/style/index.css');
|
|
15
15
|
@import url('~@jupyterlab/codemirror/style/index.css');
|
|
16
16
|
@import url('~@jupyterlab/docregistry/style/index.css');
|
|
17
|
+
@import url('~@jupyterlab/outputarea/style/index.css');
|
|
17
18
|
@import url('~@jupyterlab/toc/style/index.css');
|
|
18
19
|
@import url('~@jupyterlab/cells/style/index.css');
|
|
19
20
|
@import url('~@jupyterlab/lsp/style/index.css');
|
package/style/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import '@jupyterlab/codeeditor/style/index.js';
|
|
|
14
14
|
import '@jupyterlab/documentsearch/style/index.js';
|
|
15
15
|
import '@jupyterlab/codemirror/style/index.js';
|
|
16
16
|
import '@jupyterlab/docregistry/style/index.js';
|
|
17
|
+
import '@jupyterlab/outputarea/style/index.js';
|
|
17
18
|
import '@jupyterlab/toc/style/index.js';
|
|
18
19
|
import '@jupyterlab/cells/style/index.js';
|
|
19
20
|
import '@jupyterlab/lsp/style/index.js';
|