Skip to content

nickasd/sharedb-codemirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShareDB-CodeMirror

CodeMirror bindings for ShareDB. Adapted from @ejones's sharedb-codemirror.

Usage

var ShareDB = require('sharedb/lib/client');
var CodeMirror = require('codemirror');
var ShareDBCodeMirror = require('sharedb-codemirror');

// ...

var shareDBCodeMirror = new ShareDBCodeMirror(codeMirror, {key: 'content'));
shareDBCodeMirror.attachDoc(shareDBDoc, (error) => {
	if (error) {
		console.error(error);
	}
});

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

Install with NPM

npm install https://github.com/nickasd/sharedb-codemirror

Try it out

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

Try editing both documents: the changes will appear in real time in the other browser windows.

About

CodeMirror bindings for ShareDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published