CodeMirror bindings for ShareDB
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
test
.gitignore
.travis.yml
AUTHORS
Dockerfile
History.md
LICENSE
README.md
package.json
sharedb-codemirror.js

README.md

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