JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 390
  • Score
    100M100P100Q88158F

JSON CRDT str node bindings to any generic plain text editor.

Package Exports

  • collaborative-editor
  • collaborative-editor/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (collaborative-editor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Collaborative plain text editor binding

This package provides bindings a generic implementation for binding any plain text editor to a JSON CRDT string.

Usage

Installation:

npm install json-joy collaborative-editor

Simple integration for any plain text editor:

import {StrBinding, EditorFacade} from 'collaborative-editor';
import {Model} from 'json-joy/lib/json-crdt';

const str = model.api.str(['path', 'to', 'string']);
const unbind = StrBinding.bind(str, {
  get: () => input.value,
  set: (value: string) => input.value = value,
}, true);

A detailed integration:

import {StrBinding, EditorFacade} from 'collaborative-editor';

const editor: EditorFacade = {
  // ...
};

const str = model.api.str(['path', 'to', 'string']);
const binding = new StrBinding(str, editor);
binding.syncFromModel();
binding.bind(polling);

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

Preview