You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: documents/README.md
+39-36
Original file line number
Diff line number
Diff line change
@@ -28,18 +28,18 @@ Developers can provide new extensions to support additional documents (or replac
28
28
The model, the shared model and the view will be provided through new factories and the file type will be registered directly.
29
29
For that you will need to access the [`DocumentRegistry`](https://jupyterlab.readthedocs.io/en/latest/api/classes/docregistry.DocumentRegistry-1.html) to register new [`FileType`s](https://jupyterlab.readthedocs.io/en/latest/api/interfaces/rendermime_interfaces.IRenderMime.IFileType.html), models and views. This way, when opening a new file, the [`DocumentManager`](https://jupyterlab.readthedocs.io/en/latest/api/classes/docmanager.DocumentManager-1.html) will look into the file metadata and create an instance of `Context` with the right model for this file. To register new documents, you can create factories, either a [`IModelFactory`](https://jupyterlab.readthedocs.io/en/latest/api/interfaces/docregistry.DocumentRegistry.IModelFactory.html) for the model and/or a [`IWidgetFactory`](https://jupyterlab.readthedocs.io/en/latest/api/interfaces/docregistry.DocumentRegistry.IWidgetFactory.html) for the view.
30
30
31
-
The shared model needs to be registered only if your file must be collaborative. For that you will need to register it in the [`ICollaborativeDrive`](https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/api/interfaces/docprovider.ICollaborativeDrive.html) token provided by the `@jupyter/docprovider` package.
31
+
The shared model needs to be registered only if your file must be collaborative. For that you will need to register it in the [`ICollaborativeDrive`](https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/api/interfaces/collaborative_drive.ICollaborativeDrive.html) token provided by the `@jupyter/collaborative-drive` package.
32
32
33
33
> Packaging note: when using an optional external extension (here
34
-
> `@jupyter/docprovider` from `jupyter-collaboration`), you must
34
+
> `@jupyter/collaborative-drive` from `jupyter-collaboration`), you must
35
35
> tell JupyterLab to include that package in the current extension by
36
36
> adding the following configuration in `package.json`.:
37
37
38
38
```json5
39
39
// package.json#L108-L113
40
40
41
41
"sharedPackages": {
42
-
"@jupyter/docprovider": {
42
+
"@jupyter/collaborative-drive": {
43
43
"bundled":true,
44
44
"singleton":true
45
45
}
@@ -229,7 +229,7 @@ The `DocumentModel` represents the file content in the frontend. Through the mod
229
229
230
230
## Make it collaborative
231
231
232
-
In JupyterLab v3.1, we introduced the package `@jupyterlab/shared-models` to swap `ModelDB` as a data storage to make the notebooks collaborative. We implemented these shared models using [Yjs](https://yjs.dev), a high-performance CRDT for building collaborative applications that automatically sync. You can find all the documentation of Yjs [here](https://docs.yjs.dev).
232
+
In JupyterLab v3.1, we switched from `ModelDB` as a data storage to shared models. We implemented these shared models using [Yjs](https://yjs.dev), a high-performance CRDT for building collaborative applications that automatically sync. You can find all the documentation of Yjs [here](https://docs.yjs.dev).
233
233
234
234
Yjs documents (`Y.Doc`) are the main class of Yjs. They represent a shared document between clients and hold multiple shared objects. Yjs documents enable you to share different [data types like text, Array, Map or set](https://docs.yjs.dev/getting-started/working-with-shared-types), which makes it possible to create not only collaborative text editors but also diagrams, drawings,... .
235
235
@@ -255,7 +255,7 @@ In this extension, we created:
@@ -350,13 +350,13 @@ That client is responsible for loading, saving and watching the file on disk and
350
350
to propagate all changes to all clients. This makes collaboration much more robust
351
351
in case of flaky connection, file rename,... .
352
352
353
-
In Python, Yjs protocol is implemented in the library [`y-py`](https://github.com/y-crdt/ypy). But as we provide `@jupyterlab/shared-models` helpers for the frontend, we
353
+
In Python, Yjs protocol is implemented in the library [`ycrdt`](https://github.com/jupyter-server/pycrdt). But as we provide `@jupyter/ydoc` helpers for the frontend, we
354
354
provide [`jupyter-ydoc`](https://github.com/jupyter-server/jupyter_ydoc) helpers for Python.
355
355
356
356
A shared model must inherit from `YBaseDoc`, here:
357
357
358
358
```py
359
-
# jupyterlab_examples_documents/document.py#L4-L7
359
+
# jupyterlab_examples_documents/document.py#L6-L9
360
360
361
361
fromjupyter_ydoc.ybasedocimport YBaseDoc
362
362
@@ -368,9 +368,9 @@ The shared map is added to the model like this:
0 commit comments