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
One document may have different YDoc structures, e.g. a Jupyter notebook can be opened in JupyterLab as a notebook (and it will be shown nicely with cells etc.) or as a plain text document. While the text document has a relatively simple YDoc, with only a YText for the whole content, the notebook has a YArray for cells, a YMap for metadata, etc. This finer-grained structure allows to observe changes to e.g. a cell source only, and react accordingly.
While a YDoc can be synced with another YDoc of the same structure, for instance between two browsers showing the same notebook, the same document cannot be synced when opened as two different YDocs (e.g. in text/as a notebook) in the same JupyterLab.
Proposed Solution
We could create a "Y bridge", that would make syncing the two "incompatible" YDocs possible. Something that observes changes to a YDoc and translates them to the other. It will require some interpretation, e.g. when changing the cell source in a text document, we need to do the update in the appropriate cell structure in a notebook.
Interesting idea! We can do this now, as we need a central peer to perform these changes.
However, there are "invalid" document states. E.g., when the text-representation of the JSON is not formatted correctly. In this case we mustn't update the complex shared-model representation. But it would be possible to ignore invalid document states.
It might take some time to get this right. Currently, we show a warning dialog that the file has been modified on the filesystem when this happens. This is not ideal, but it is a very clean and understandable UI experience.
Problem
One document may have different YDoc structures, e.g. a Jupyter notebook can be opened in JupyterLab as a notebook (and it will be shown nicely with cells etc.) or as a plain text document. While the text document has a relatively simple YDoc, with only a YText for the whole content, the notebook has a YArray for cells, a YMap for metadata, etc. This finer-grained structure allows to observe changes to e.g. a cell source only, and react accordingly.
While a YDoc can be synced with another YDoc of the same structure, for instance between two browsers showing the same notebook, the same document cannot be synced when opened as two different YDocs (e.g. in text/as a notebook) in the same JupyterLab.
Proposed Solution
We could create a "Y bridge", that would make syncing the two "incompatible" YDocs possible. Something that observes changes to a YDoc and translates them to the other. It will require some interpretation, e.g. when changing the cell source in a text document, we need to do the update in the appropriate cell structure in a notebook.
cc @dmonad @hbcarlos
Additional context
See jupyterlab/jupyterlab#12360 (comment).
The text was updated successfully, but these errors were encountered: