soney / sharedb-ace

ShareDB bindings for Ace Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sharedb-ace

https://badge.fury.io/js/sharedb-ace.svg

Sharedb-ace provides two-way bindings between ShareDB and Ace Editor.

Installation

Using npm:

npm install sharedb-ace

Using pre-compiled js from unpkg CDN:

<script src="https://unpkg.com/sharedb-ace@latest/dist/sharedb-ace.min.js"></script>

Documentation

Please see here for internals documentation.

Single Ace-editor Instance

Setup the ShareDB document as a string:

ShareAce.on('ready', function() {
  ShareAce.add(editor, [], [ Plugins, Here ]);
});

Multiple Ace-editor Instances

Your setup may be more complex, and requires the use of multiple ace-instances synchronized over one connection. Setup the ShareDB document to be a JSON object.

For example:

{
  "foo": "",
  "bar": ""
}

Next, connect the two paths to two separate ace editor instances:
ShareAce.on('ready', function() {
  ShareAce.add(editor1, ["foo"], []);
  ShareAce.add(editor2, ["bar"], []);
});

Developing sharedb-ace

  1. Fork or clone this repo:
git clone https://github.com/jethrokuan/sharedb-ace.git
cd sharedb-ace && yarn install

Generating JS Docs

We generate javascript documentation using inline documentation.

jsdoc source/*.js --destination ./docs/

About

ShareDB bindings for Ace Editor


Languages

Language:JavaScript 100.0%