ace-collab
v0.17.0
Published
### Prerequisites
Readme
Ace Collab
Prerequisites
Make sure that you have installed:
- NodeJS (v8.10.0)
- npm (v3.5.2)
Usage
- Install
ace-collabas a dependency usingnpm:
npm install ace-collabEditor
- Import
Editorfromace-collab:
import Editor from 'ace-collab'- Initialize new
Editorinstance:
const editorConfig = {
anchorDOM: document.querySelector('#editor'),
mode: 'ace/mode/csharp',
theme: 'ace/theme/monokai',
}
const editor = new Editor(editorConfig)- Initialize new collab session by using
initmethod:
const serverConfig = {
docId: '', // Provide empty if want to create new session, provide value if want to join existing one
host: '127.0.0.1',
port: '3333',
username: 'John Doe',
ssl: false,
}
const readOnly = false // if set to true, only admin will be able to modify the code
editor.init(serverConfig, readOnly);Server
- Import and run
startServerfunction fromace-collab:
import startServer from 'ace-collab/lib/server'
const serverConfig = {
allowedOrigins: [], // Provide empty if want to allow entrance for every host, provide string values if want to allow only few
host: '0.0.0.0',
port: 3333,
}
startServer(serverConfig)