Skip to content

Commit c6a88e0

Browse files
committed
fix missing plugin error, now works w/ JCollab4
1 parent 870bf65 commit c6a88e0

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"watch:labextension": "jupyter labextension watch ."
6060
},
6161
"dependencies": {
62-
"@jupyter/collaborative-drive": "^4.0.2",
62+
"@jupyter/collaborative-drive": "^4",
6363
"@jupyter/ydoc": "^2.1.3 || ^3.0.0",
6464
"@jupyterlab/application": "^4.4.0",
6565
"@jupyterlab/apputils": "^4.4.0",

src/index.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
} from '@jupyterlab/apputils';
2424
import { KeyboardEvent } from 'react';
2525
import { IToolbarWidgetRegistry } from '@jupyterlab/apputils';
26+
import { INotebookCellExecutor, runCell } from '@jupyterlab/notebook';
2627
import { AwarenessExecutionIndicator } from './executionindicator';
2728

2829
import { requestAPI } from './handler';
@@ -281,6 +282,28 @@ export const kernelStatus: JupyterFrontEndPlugin<IKernelStatusModel> = {
281282
}
282283
};
283284

285+
/**
286+
* Notebook cell executor plugin, provided by JupyterLab by default. Re-provided
287+
* to ensure compatibility with `jupyter_collaboration`.
288+
*
289+
* The `@jupyter/docprovider-extension` disables this plugin to override it, but
290+
* we disable that labextension, leaving `INotebookCellExecutor` un-implemented.
291+
* This plugin fixes that issue by re-providing this plugin with `autoStart:
292+
* false`, which specifies that this plugin only gets activated if no other
293+
* implementation exists, e.g. only when `jupyter_collaboration` is installed.
294+
*/
295+
export const backupCellExecutorPlugin: JupyterFrontEndPlugin<INotebookCellExecutor> =
296+
{
297+
id: '@jupyter/server-documents:backup-cell-executor',
298+
description:
299+
'Provides a backup default implementation of the notebook cell executor.',
300+
autoStart: false,
301+
provides: INotebookCellExecutor,
302+
activate: (): INotebookCellExecutor => {
303+
return Object.freeze({ runCell });
304+
}
305+
};
306+
284307
const plugins: JupyterFrontEndPlugin<unknown>[] = [
285308
rtcContentProvider,
286309
yfile,
@@ -291,7 +314,8 @@ const plugins: JupyterFrontEndPlugin<unknown>[] = [
291314
executionIndicator,
292315
kernelStatus,
293316
notebookFactoryPlugin,
294-
codemirrorYjsPlugin
317+
codemirrorYjsPlugin,
318+
backupCellExecutorPlugin
295319
];
296320

297321
export default plugins;

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ __metadata:
20122012
languageName: node
20132013
linkType: hard
20142014

2015-
"@jupyter/collaborative-drive@npm:^4.0.2":
2015+
"@jupyter/collaborative-drive@npm:^4":
20162016
version: 4.0.2
20172017
resolution: "@jupyter/collaborative-drive@npm:4.0.2"
20182018
dependencies:
@@ -2038,7 +2038,7 @@ __metadata:
20382038
version: 0.0.0-use.local
20392039
resolution: "@jupyter/server-documents@workspace:."
20402040
dependencies:
2041-
"@jupyter/collaborative-drive": ^4.0.2
2041+
"@jupyter/collaborative-drive": ^4
20422042
"@jupyter/ydoc": ^2.1.3 || ^3.0.0
20432043
"@jupyterlab/application": ^4.4.0
20442044
"@jupyterlab/apputils": ^4.4.0

0 commit comments

Comments
 (0)