Froala
Enable real-time co-editing for Froala
Add the Codox JavaScript library and css files:
<script src="https://cdn1.codox.io/lib/2.x/api/wave.client.js" type="text/javascript"></script>
<link href="https://cdn1.codox.io/lib/2.x/css/wave.client.css" rel="stylesheet">

Add the following JavaScript block to your application to enable real-time co-editing for Froala. Replace the
apiKey
field with your own, which you can get here.1
const codox = new Codox();
2
3
new FroalaEditor('#editor', {
4
events: {
5
//setting up on initialization event
6
'initialized': function() {
7
//Adding codox configuration
8
const editor = this;
9
const config = {
10
"app" : "froala",
11
"docId" : "mydoc",
12
"user" : {
13
"name" : "Joe Smith",
14
},
15
"editor" : editor,
16
"apiKey" : "d5bb1f48-356b-4032-8d0c-ba1a79396f79", //replace this
17
};
18
19
codox.init(config);
20
}
21
}
22
The co-editing session will start inside the Froala editor instance specified in the
editor
attribute. Before invoking
codox.init()
the Froala editor should be fully initialized. In the example code, we ensure that Froala is initialized first by adding an initialized
event hook to Froala's constructor.The values for
docId
andusername
should come from your document management service. Codox expects docId
to be globally unique across your service. Every co-editing session should have its distinct
codox
object. That means if you are running multiple instances of Froala editor on the same page or with in the same application, there should be multiple instances of codox,
one for each Froala editor instance or document fragment (note: each document fragment should be uniquely identifiable). The
config
parameter is a JSON object with the following key-value pairs:Key | | Value |
app | (required) | string |
docId | (required) | string |
user | (required) | object |
apiKey | (required) | string |
editor | (required) | Froala |
autoStart | (optional) | boolean |
string
The static string value
'froala'
string
A unique identifier for the document. In a content management service, this could for example be the resource identifier for the document.
object
A user meta-data object.
Key | | Value |
name | (optional) | string |
email | (optional) | string |
avatar | (optional) | string |
id | (optional) | string |
For a content management service, this field should be set for each logged-in user based on their credentials. The value of
user.name
will be used to render the default text-based initials avatar. To create an image-based avatar, set user.avatar
to the path of the image resource. string
Froala
A reference to a Froala editor instance, in which the co-editing session should be bootstrapped.
boolean
Set to
true
to start the co-editing session automatically on init(config)
. Set to false
to initialize but delay start the co-editing (see the start()
client API). Default setting is true
. Last modified 5d ago