Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@lexical/yjs
Advanced tools
@lexical/yjs is an npm package that integrates Lexical, a text editor framework, with Yjs, a real-time collaboration framework. This package allows developers to create collaborative text editing experiences where multiple users can edit the same document simultaneously with real-time updates.
Real-time Collaboration
This feature allows multiple users to collaborate on the same document in real-time. The code sample demonstrates how to set up a Lexical editor with Yjs WebSocket provider to enable real-time collaboration.
const { createEditor } = require('lexical');
const { WebsocketProvider } = require('y-websocket');
const { yjsPlugin } = require('@lexical/yjs');
const editor = createEditor();
const provider = new WebsocketProvider('wss://demos.yjs.dev', 'my-roomname', editor);
editor.registerPlugin(yjsPlugin(provider));
Conflict Resolution
This feature ensures that any conflicts that arise during real-time collaboration are automatically resolved. The code sample shows how to listen for the 'synced' event to confirm that all conflicts have been resolved.
const { createEditor } = require('lexical');
const { WebsocketProvider } = require('y-websocket');
const { yjsPlugin } = require('@lexical/yjs');
const editor = createEditor();
const provider = new WebsocketProvider('wss://demos.yjs.dev', 'my-roomname', editor);
editor.registerPlugin(yjsPlugin(provider));
provider.on('synced', (isSynced) => {
if (isSynced) {
console.log('All conflicts have been resolved.');
}
});
Offline Editing
This feature allows users to continue editing the document even when they are offline. The code sample demonstrates how to set up IndexedDB persistence to enable offline editing.
const { createEditor } = require('lexical');
const { IndexeddbPersistence } = require('y-indexeddb');
const { yjsPlugin } = require('@lexical/yjs');
const editor = createEditor();
const persistence = new IndexeddbPersistence('my-database', editor);
editor.registerPlugin(yjsPlugin(persistence));
slate-yjs integrates Slate, another text editor framework, with Yjs for real-time collaboration. Similar to @lexical/yjs, it allows multiple users to edit the same document simultaneously. However, it is designed specifically for use with the Slate editor.
FAQs
The library provides Yjs editor bindings for Lexical.
We found that @lexical/yjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.