Contribute to this guide

guideRestricted editing

The restricted editing feature allows you to define which parts of a document can be editable for a group of users who have more restricted editing rights.

In order to do that, this feature introduces two editing modes:

  • Standard editing mode – In this mode the user can freely edit the content and choose regions that should be editable in the restricted editing mode.
  • Restricted editing mode – When the editor is initialized in this mode, the user can only edit the content within the regions chosen by the user in the standard editing mode.

You can imagine a workflow in which a certain group of users is responsible for creating templates of documents while a second group of users can only fill the gaps (for example, fill the missing data, like names, dates, product names, etc.).

By using this feature, the users of your application will be able to create template documents. In a certain way, this feature could be used to generate forms with rich-text capabilities. This kind of practical application is shown in the How to create ready-to-print documents with CKEditor 5 pagination feature blog post.

See also the read-only feature that lets you turn the entire WYSIWYG editor into read-only mode. You can also read the dedicated blog post about write-restricted editor modes.

The Restricted editing feature is enabled by default in the superbuild only. See the installation section to learn how to enable it in your editor.

# Demo

The demo below allows you to emulate both modes. You can start from creating a template of the document in the standard editing mode. Select a section of text and use the toolbar button Enable editing to turn selected area into an editable region or to remove an existing one.

Then you can switch to the restricted editing mode to see how the editable and non-editable regions behave.

Tip: Use Tab to navigate from one editable region to another (and Shift+Tab to move back) in the restricted mode.


Dear Customer Name,

thank you for contacting us. Your case was logged as Case ID and is assigned to Technician Name. We will attempt to resolve your issue within the next Time hours.

Should you need any further assistance, do not hesitate to contact our Customer Support Hotline at Hotline Number.

Yours sincerely,
Customer Support Team

This demo only presents a limited set of features. Visit the full-featured editor example to see more in action.

There are more features that help control user permissions in the WYSIWYG editor:

  • Read-only – Turn the entire content of the editor read-only.
  • Track changes – User changes are marked in the content and shown as suggestions in the sidebar for acceptance or rejection.
  • Comments – Users can add comments to any part of the content instead of editing it directly.

Read this CKEditor Ecosystem blog post on how to couple restricted editing with other features to create editable document templates.

# Configuration

It is possible to configure which features should be available in the restricted mode. For instance, the following configuration will not only allow typing and deleting but also bolding text.

import RestrictedEditingMode from '@ckeditor/ckeditor5-restricted-editing/src/restrictededitingmode';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';

    .create( document.querySelector( '#editor' ), {
        plugins: [ Bold, RestrictedEditingMode, ... ],
        toolbar: [ 'bold', '|', 'restrictedEditing', ... ],
        restrictedEditing: {
            allowedCommands: [ 'bold' ]
    } )
    .then( ... )
    .catch( ... );

Note: Typing and deleting text is always possible in restricted editing regions. For more information, check out the config.restrictedEditing documentation.

# Enabling commands in the restricted editing mode

The restricted editing mode allows modifying the editor content only in designated regions. Outside these regions most of the editor commands are disabled by default. If you wish to enable some commands outside the restricted editing regions you can use the RestrictedEditingModeEditing.enableCommand() method. This method must be executed in the afterInit() callback of an editor plugin.

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

class MyPlugin extends Plugin {
    afterInit() {
        this.editor.plugins.get( 'RestrictedEditingModeEditing' ).enableCommand( 'myCommand' );

# Installation

To add this feature to your rich-text editor, install the @ckeditor/ckeditor5-restricted-editing package:

npm install --save @ckeditor/ckeditor5-restricted-editing

# Running the standard editing mode

In order to initialize the editor in the standard editing mode, add the StandardEditingMode plugin and add the 'restrictedEditingException' button to the toolbar:

import StandardEditingMode from '@ckeditor/ckeditor5-restricted-editing/src/standardeditingmode';

    .create( document.querySelector( '#editor' ), {
        plugins: [ StandardEditingMode, ... ],
        toolbar: [ 'restrictedEditingException', ... ]
    } )
    .then( ... )
    .catch( ... );

# Running the restricted editing mode

In order to initialize the editor in the restricted editing mode, add the RestrictedEditingMode plugin and add the 'restrictedEditing' button to the toolbar:

import RestrictedEditingMode from '@ckeditor/ckeditor5-restricted-editing/src/restrictededitingmode';

    .create( document.querySelector( '#editor' ), {
        plugins: [ RestrictedEditingMode, ... ],
        toolbar: [ 'restrictedEditing', ... ]
    } )
    .then( ... )
    .catch( ... );

Read more about installing plugins.

# Common API

The StandardEditingMode plugin registers:

  • The 'restrictedEditingException' button that allows marking regions as editable.
  • The 'restrictedEditingException' command that allows marking regions as editable.

The RestrictedEditingMode plugin registers:

  • The 'restrictedEditing' dropdown that allows navigating between editable regions.
  • The 'goToPreviousRestrictedEditingException' and 'goToNextRestrictedEditingException' commands that allow navigating between editable regions.

We recommend using the official CKEditor 5 inspector for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more.

# Real-time collaboration

When using real-time collaboration, all the connected users should always be in the same mode. It is not possible to have a different list of plugins enabled among users of a single collaborative session.

# Contribute

The source code of the feature is available on GitHub in