guofoo / sharedb-codemirror

CodeMirror bindings for ShareDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShareDB-CodeMirror Build Status Dependencies devDependency Status

CodeMirror bindings for ShareDB. Adapted from @aslakhellesoy's share-codemirror.

Usage

var CodeMirror = require('codemirror');
var ShareDBCodeMirror = require('sharedb-codemirror');

// ...

var codeMirror = CodeMirror.fromTextArea(elem);
ShareDBCodeMirror.attachDocToCodeMirror(shareDBDoc, codeMirror);

That's it. You now have two-way sync between ShareDB and CodeMirror. A full example is available in examples/.

Install with NPM

npm install sharedb-codemirror

Try it out

npm install
npm start
# in a couple of browsers...
open http://localhost:7007

Try clicking the infinite monkeys button. Do it in both browsers. Wait for poetry to appear.

Run tests

npm install
npm test

With test coverage:

npm run test-cover
open coverage/lcov-report/index.html

About

CodeMirror bindings for ShareDB

License:MIT License


Languages

Language:JavaScript 99.4%Language:Dockerfile 0.6%