Socket
Book a DemoInstallSign in
Socket

collaborative-codemirror

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collaborative-codemirror

Binding for collaborative editing support in Codemirror Editor. Connects JSON CRDT str node to Codemirror Editor.

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
24
140%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Usage

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();

Preview

  • See demo.

Keywords

codemirror

FAQs

Package last updated on 16 May 2025

Did you know?

Socket

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.

Install

Related posts