Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyterlab>4.1 #69

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions js/jupyterlab-deck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
},
"types": "lib/index.d.ts",
"dependencies": {
"@jupyterlab/application": "3 || 4",
"@jupyterlab/apputils": "3 || 4",
"@jupyterlab/fileeditor": "3 || 4",
"@jupyterlab/markdownviewer": "3 || 4",
"@jupyterlab/notebook": "3 || 4",
"@jupyterlab/statusbar": "3 || 4",
"@jupyterlab/ui-components": "3 || 4",
"@jupyterlab/application": "^4.1.0",
"@jupyterlab/apputils": "^4.2.0",
"@jupyterlab/fileeditor": "^4.1.0",
"@jupyterlab/markdownviewer": "^4.1.0",
"@jupyterlab/notebook": "^4.1.0",
"@jupyterlab/statusbar": "^4.1.0",
"@jupyterlab/ui-components": "^4.1.0",
"d3-drag": "3"
},
"devDependencies": {
"@deathbeds/jupyterlab-fonts": "^3.0.0",
"@jupyter-notebook/application": "^7.0.5",
"@jupyter-notebook/application": "^7.1.0",
"@jupyterlab/builder": "^4.0.7",
"@types/d3-drag": "3"
},
Expand Down
24 changes: 22 additions & 2 deletions js/jupyterlab-deck/src/notebook/presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
protected _extents = new Map<INotebookModel, NotebookPresenter.TExtentMap>();
protected _layers = new Map<INotebookModel, NotebookPresenter.TLayerMap>();

private _windowingModeBackup: 'defer' | 'full' | 'none' = 'full';

constructor(options: NotebookPresenter.IOptions) {
this._manager = options.manager;
this._commands = options.commands;
Expand Down Expand Up @@ -90,6 +92,13 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
}
this._removeStyle(panel);
panel.content.activeCellChanged.disconnect(this._onActiveCellChanged, this);

// restore the windowing mode of the notebook.
panel.content.notebookConfig = {
...panel.content.notebookConfig,
windowingMode: this._windowingModeBackup
};

panel.update();

const { activeCell } = panel.content;
Expand All @@ -106,6 +115,14 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {

public async start(panel: NotebookPanel): Promise<void> {
const { model, content: notebook } = panel;

// Switch to not windowing mode
this._windowingModeBackup = notebook.notebookConfig.windowingMode;
notebook.notebookConfig = {...panel.content.notebookConfig, windowingMode: 'none'};
// Force viewport properties that may not be properly set, depending on lab version.
notebook.viewportNode.style.minHeight = '';
(notebook.viewportNode.parentNode as HTMLDivElement).style.height = '';

if (model) {
const _watchPanel = async (change: any) => {
/* istanbul ignore if */
Expand Down Expand Up @@ -307,7 +324,7 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
this._commands.addKeyBinding({
command: CommandIds[direction],
keys: DIRECTION_KEYS[direction],
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:focus`,
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) :focus`,
});
}
for (const [directions, keys] of COMPOUND_KEYS.entries()) {
Expand All @@ -316,7 +333,7 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
command: CommandIds.go,
args: { direction, alternate },
keys,
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:focus`,
selector: `.${CSS.deck} .jp-Notebook.jp-mod-commandMode:not(.jp-mod-readWrite) :focus`,
});
}
}
Expand Down Expand Up @@ -505,6 +522,9 @@ export class NotebookPresenter implements IPresenter<NotebookPanel> {
if (this._manager.layover) {
this._manager.layover.model.parts = onScreen;
}

// Force the focus on the new active cell.
notebook.activeCell?.node.focus();
}

protected _forceStyle() {
Expand Down
5 changes: 5 additions & 0 deletions js/jupyterlab-deck/style/notebook.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ body[data-notebook='notebooks']
position: fixed;
}

/** cell focus not visible **/
.jp-Deck .jp-Notebook.jp-mod-commandMode .jp-Cell.jp-mod-active:focus-visible {
box-shadow: none;
}

/** markdown tweaks **/
.jp-Deck .jp-MarkdownOutput {
border: 0;
Expand Down
4 changes: 3 additions & 1 deletion js/jupyterlab-deck/style/shell.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
body[data-jp-deck-mode='presenting'] {
body[data-jp-deck-mode='presenting'],
body[data-jp-deck-mode='presenting'] .jp-ThemedContainer:has(.jp-Deck),
body[data-jp-deck-mode='presenting'][data-notebook='notebooks'] .jp-WindowedPanel-outer {
background: var(--jp-layout-color0);
}

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
requires-python = ">=3.8"
dynamic = ["description"]
dependencies = [
"jupyterlab >=3.5,<5.0.0a0",
"jupyterlab >=4.1,<5.0.0a0",
"jupyterlab-fonts >=3.0.0"
]

Expand Down
Loading