A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/streamich/collaborative-codemirror below:

streamich/collaborative-codemirror: Codemirror support for collaborative editing using JSON CRDT

Codemirror collaborative binding

Makes a plain Codemirror editor instance collaborative by binding it to a JSON CRDT document str node. This allows multiple users to edit the same document json-joy JSON CRDT document concurrently through the Codemirror editor.

Installation:

npm install json-joy codemirror collaborative-codemirror

Usage:

import {EditorView} from 'codemirror';
import {bind} from 'collaborative-codemirror';
import {Model, s} from 'json-joy/lib/json-crdt';

// Create a JSON CRDT model.
const model = Model.create(s.str(''));

// Create a Code Mirror editor instance.
const editor = new EditorView({parent: div});

// Connect Code Mirror editor to JSON CRDT document "str" node.
const unbind = bind(model.s.toApi(), editor);

// When done, unbind the binding.
binding.unbind();

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4