-
-
Notifications
You must be signed in to change notification settings - Fork 614
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
Draft: CodeMirror over Yjs prototype #1005
Draft
theova
wants to merge
15
commits into
main
Choose a base branch
from
yjs
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awesome! i see y-codemirror has a y-codemirror-next for cm6 support. Have you considered trying that out? cm6 introduces a lot of accessibility improvements, and i know they've improved realtime editing capabilities as well |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a prototype of how to use Yjs in CryptPad to achieve local-first editing for the
code
application.This PR is to document and discuss the prototype, it is not meant to be merged.
Setup
To try out this prototype, you currently need to run two components:
the modified CryptPad instance and the Yjs backend that serves the websocket requests.
1.1. Clone and checkout this fork (
yjs
)1.2.
npm i
1.3.
npm run dev
2.1. Clone https://github.com/theova/y-websocket and checkout the branch
crypto
2.2.
npm i
2.3.
npm start
In a later step, the Yjs backend should be integrated into the CryptPad server, so that only one component has to be started.
Bundle Yjs
Yjs cannot be installed straightforward via bundle and does not provide minified versions.
We therefore bundle Yjs and the required components (including y-websocket and y-codemirror 5).
The "factory" is in
scripts/yjs/yjs_bundle.js
.To bundle this to a minified version (
www/lib/yjs_bundle.js
) runnpm run bundle-yjs
.Problems/Simplifications
This prototype is heavily simplifed, due to the complexity of the codebase, but not due to natural limitations.
The simplifications include:
code
application (e.g., cryptpad.fr/code/)localhost:3000/code
, the resultingeditKeyStr
is not the same as the one coming from the generated URL hash. After a reload, this is fixed.