Report an issue

guideReal-time collaborative comments

The real-time collaboration package contains a ready-to-use comments integration. When using it, you do not need to create any adapters to define how to store the comments data since they are saved in CKEditor Cloud Services.

The real-time collaborative comments feature requires the RealTimeCollaborativeEditing plugin to work. The real-time collaborative editing plugin takes care of sending the comment markers in text. It also ensures that all clients have the same document version when a user adds a comment to a part of it.

This tutorial starts where the Real-time collaborative editing and Comments overview guides end, so if you are not familiar with them yet, go there first.

To enable this feature, you need the RealTimeCollaborativeComments plugin to be included in your build. If you are using the build from the quick start guide it is already included, but if you are creating your custom build in any other way, you need to include it manually now.

Complementary to this guide, we provide ready-to-use samples available for download. We prepared samples for all editor types (multi-root included) as well as for the React integration. You may use them as an example or as a starting point for your own integration.

To make collaborative comments work, you need to make three changes in the code from the Real-time collaborative editing tutorial:

  • Set up a two-column layout.
  • Add the sidebar configuration.
  • Add the comment button to the toolbar. If you use the ImageToolbar plugin, add the comment button to the image toolbar separately.

An updated sample should look like this:

<!DOCTYPE html>
        <meta charset="utf-8">
        <title>CKEditor 5 Collaboration – Hello World!</title>

        <style type="text/css">
         #container {
             /* To create the column layout. */
             display: flex;

             /* To make the container relative to its children. */
             position: relative;

         #container {
             /* To stretch the editor to max 700px 
                (just to look nice for this example but it can be any size). */
             width: 100%;
             max-width: 700px;

         #sidebar {
            /* Set some size for the sidebar (it can be any). */
            min-width: 300px;

            /* Add some distance. */
            padding: 0 10px;

    <div id="container">
        <div id="editor"></div>
        <div id="sidebar"></div>

    <script src="../build/ckeditor.js"></script>
        ClassicEditor.create( document.querySelector( '#editor' ), {
            initialData: '<p>Let\'s edit this together!</p>',
            toolbar: [ 'bold', 'italic', 'imageUpload', 'comment' ],
            plugins: [ 'Essentials', 'Paragraph', 'Bold', 'Italic', 'EasyImage', 'RealTimeCollaborativeComments' ],
            cloudServices: {
                tokenUrl: '',
                uploadUrl: '',
                webSocketUrl: '',
                documentId: 'collaboration'
            sidebar: {
                container: document.querySelector( '#sidebar' )
        } )
        .catch( error => console.error( error ) );

Note that you do not need to manually import the RealTimeCollaborativeEditing and Comments plugins anymore. The collaborative comments plugin requires them and will enable them automatically.

Also, note that to make the integration work out of the box, all comments are saved in CKEditor Cloud Services, so there is no need to handle comments content or authors. However, if any comment is added, the corresponding marker is added to your document content. To learn more, see the Comments markup section.

We understand that due to legislation or your company’s policy you may be required to store such data in your own data center or private cloud. This is why we also provide the on-premises version of CKEditor Cloud Services. Contact us to learn more about it.

This is it. You should now be able to add real-time collaborative comments to your rich-text document, and you should see them on all clients.