-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
feat: realtime collaborative editing #319
Conversation
We did this by: 1. Copying `support/templates/extension-template` to `extension-yjs` 2. Renaming `template`, `Template` and `TEMPLATE` in the new package to `yjs`, `Yjs` and `YJS` 3. Renaming the files from `template-` to `yjs-` 4. Adding `packages/remirror/extension/yjs/package.json` 5. Adding `packages/remirror/src/extension/yjs.ts` 6. Edit `packages/remirror/package.json` to add dependency and entrypoint 7. Run `pnpm i` in root
💥 No ChangesetLatest commit: a883ece Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂 If these changes should be published to npm, you need to add a changeset. This PR includes no changesetsWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Click here to learn what changesets are, and how to add one. Click here if you're a maintainer who wants to add a changeset to this PR |
function forceTermination() { | ||
const timeout = global.setTimeout(() => { | ||
console.log( | ||
"Look, I'm just a script, and far be it for me to tell you your job, dear human, but it seems to me that something has been keeping me alive for the last 5,000,000 nanoseconds (which feels like an eternity to me) since I completed my task. Maybe something opened a network connection? Who knows. Either way, it doesn't seem right, so I'm going to go ahead and exit.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
import { css } from 'linaria'; | ||
|
||
/** | ||
* yjs typings are very rough; so we define here the interface that we require |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in y-webrtc@10.1.5 - I forgot to publish the tsc files.
It might be a good idea to remove the Observable import from lib0. Just because of this import, this extension won't run in node<12 because lib0 is an esm module. The modules in the Yjs repo are not affected because their bundle points to lib0/dist/[module].cjs
which is a commonjs module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well.. let me know if it is not fixed 😉 Trying to keep the typescript definitions up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome; Ifi was planning to contribute back some improved typings, but good to know they’re available soon! We need a “provider” type that all providers implement (webrtc, websockets), is there such a thing, @dmonad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea. No there is not at the moment, but I'll add one in the next release yjs/yjs#215
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 🙌
Description
This PR replaces #238; adding yjs support for the new Remirror. This can be demonstrated with the following code in the playground (advanced mode):
As recommended by @dmonad in #238 we've switched over to
y-webrtc
so that the editing Just Works ™️ rather than requiring an external server.Checklist
pnpm run fix
completed successfully.pnpm run test
.Screenshots
Future tasks