Initialization

codox.init(config)

Once a codox instance has been created, you should initialize thecodox instance with app specific configurations. The general structure of the config JSON is as follows:

Key

Value

app

(required)

string

docId

(required)

string

apiKey

(required)

string

user

(required)

object

editor

(required)

Quill

autoStart

(optional)

boolean

avatar

(optional)

object

showUI

(optional)

boolean

showCursor

(optional)

boolean

username

(deprecated)

string

Description

app

string

The static string value 'froala', 'quill', or 'tinymce'

docId

string

A unique identifier for the document. In a content management service, this could for example be the resource identifier for the document.

The uniqueness of the identifier is essential to avoid collisions between one co-editing session and another. In particular, if you are running multiple subdomains for user subscriptions, make sure the docId is "namespaced" and unique across all the subdomains .

apiKey

string

The API key for the integration. You can obtain a key from your account dashboard.

user

Object

This user field allows you to attach app specific meta-data to the user.

Key

Value

name

(optional)

string

email

(optional)

string

avatar

(optional)

string

id

(optional)

string

The value of the avatarfield is a link to an image resource.

The 'user' object will be emitted on 'users_update' event.

editor

Object

A reference to an editor instance for which the co-editing session should start in. For Froala and Quill integrations, assign editor the reference to the editor object. For TinyMCE, the plugin will pass in the editor object reference automatically.

Each codox instance is bound to a single editor instance. If the editor is destroyed and recreated as part of some UI framework lifecycle events, then a new codox object should be created with the new editor instance.

autoStart (optional)

boolean

Set to true to start co-editing immediately on call toinit(config). Set to false to initialize but delay the start to co-editing (see the codox.start() client API).

Default to true.

avatar (optional)

object

This is an optional configuration parameter that determines the position of the avatars relative to the editor window.

Key

Value

left

(optional)

boolean

vertical

(optional)

boolean

The avatars are placed horizontally by the top-right corner of the editor window by default.

left and verticalboth default to false

showUI (optional)

boolean

Set to true to show avatars for online users. Set to false to hide the avatars.

Defaults to true.

showCursor (optional)

boolean

Set to true, to display cursor positions and selections for remote co-editing users. Set to false to hide cursor positions and selections.

Defaults to true.

username (optional)

string

The name of the user joining the co-editing session. For a content management service, this should be set for each logged-in user based on their credentials. This name will be displayed during real-time co-editing sessions.

username is deprecated and will be removed in the next major release (v2). Please use the user meta-data field.

Please refer to individual editor integration instructions on how to specify the values of these parameters.