sharedb-codemirror
v0.3.0
Published
CodeMirror bindings for ShareDB
Downloads
43
Readme
ShareDB-CodeMirror
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