Feature of the month - restricted editing modes

Writing, editing — all of that is generally about the ability to access the content faster better, more efficiently. To add, remove, change, and rewrite yet again. Still, there are situations when an editor or a reader should not be able to change the content. Sounds surprising? Maybe so. Maybe not so much.

There are cases where one would only need to show the ready document to end-users or ask them for an opinion. Sometimes it would be a trade deal that only needs to be signed, sometimes the content needs to be commented on before any changes are made by an authorized editor, and sometimes — e.g. in the case of online forms — only certain parts or even single words need to be filled in. With CKEditor 5 we have ways to cover all those needs!

# Read-only documents

A situation where the content should not be changed but should only be available for viewing for a selected group of users is the simplest and most obvious one. It may be some business presentation, a discussion over a trade deal, contract proposal — all the cases where the content is in place already and it will be worked on more, but rather by designated users to prevent chaos.

This ability is provided thanks to CKEditor 5’s read-only support, which is a toggle switch and ensures no changes can be made to the content. You can observe the difference between the regular and the read-only mode in the screencast below.

Switching to read-only mode turns off editing features.
Switching to read-only mode turns off editing features.

You may have noticed that although the editing features become grayed-out in read-only mode, some of the toolbar items are still available. All features and functions that affect the content are blocked. However, functionalities like export to PDF or Word or search are still available to use. This is a handy solution if you only want to prevent changes to the original document but do not want to block basic operations or the ability to distribute it.

Should you need to prevent the users from any interaction with the content, the toolbar can be configured to hide when entering the read-only mode, as shown in the screencast below. This can be easily achieved with some custom code.

Switching to read-only mode turns off the whole toolbar.
Switching to read-only mode turns off the whole toolbar.

Whatever the level of control is needed, CKEditor 5 provides easily configurable solutions for any possible real-life applications.

# Comments-only mode

Sometimes merely presenting the content is not enough. Especially at the final stages of the document edition, second opinions are a must for certain contexts. There are several ways to do it and tracked changes to the text is one, as well as our very own versioning tool — the revision history to name just two of them.

Sometimes, however, the document should not be changed, but comments are welcome. It would be in situations like discussing a draft of a white paper, talking over a trade deal proposal (which needs to be edited only by authorised persons, maybe just lawyers), or simply gathering feedback on a piece of a sales presentation that is almost ready to be delivered. This is where the comments-only mode comes into play. When it is activated, the user is allowed to create, edit and remove the comments but not to change the document content.

The comments-only mode allows only adding comments, apparently. And using features that do not affect the content.
The comments-only mode allows only adding comments, apparently. And using features that do not affect the content.

As you can see in the above example, the toolbar is mostly inactive after switching to comments-only mode. The only available items are export to PDF, export to Word and of course the comments button, which allows the user to add comments to selected content fragments, but not to change these. This is a great way to pass some suggestions, opinions, or needed corrections without altering the original content.

This restricted mode can be introduced via the users subsystem of CKEditor 5. To enable or disable editing for certain users or user groups, proper user permissions should be applied.

However, if the user permissions are not utilized in your integration or for some reason you need to use some other logic, the comments-only mode can be set using the CommentsOnly API class and the CommentsOnly#isEnabled property. You can read more about it in the Enabling comments-only mode guide.

# Restricted editing

Out of the three available modes that restrict content interaction, the restricted editing mode is the only one that, in fact, allows for changing the document. It is, however, strictly controlled and the portions of the content that can be edited are predefined.

This is a two-step process. First, in the regular mode, an authorized editor sets editable regions that can later be accessed by users in the restricted mode. Only then, after switching to restricted editing mode, the user can interact with the document — but only within the preset areas.

You can see both the preparation process and the editing process in the screencast below.

Once the editable regions are ready and edition mode is changed, the editor can fill in the data.
Once the editable regions are ready and edition mode is changed, the editor can fill in the data.

First, the editor prepares an editable region by selecting the desired words or phrases and marking them as such in this email response template. All editing capabilities are enabled at this stage for regular content creation. Once it is done and the mode is switched, another person — in this case, a designated operator — fills in the information and later sends the response.

This is a perfect way to create document templates or mail merge. This kind of work would be perfect for archives, offices, recruitment processes or practically anywhere in the business area that deals with serialized information, bulk or not. A case study on our blog shows an example of restricted editing used in connection with the pagination and export to PDF features to generate forms with rich-text capabilities, that can later be exported to portable, finalized documents.

# Embrace restricted write-permission modes

There is no doubt that content creation is all about, well, creation. About writing, editing, changing, tailoring the documents to one’s needs. Sometimes that latter task requires restricting the editor’s access to the content, but it never means restricting interactions. Whatever your use case, the restricted editing modes will be great not only for the content creation phase but also as an end-user solution, where limited interaction is part of the process. Be that technology, business or office environment, CKEditor 5, thanks to its innate flexible design is sure to meet all needs and expectations.

Feature of the month is a series of articles showcasing these more utilized and those sometimes less known features of CKEditor 5. You may want to check out other blog posts dedicated to features like tables, collaboration, spell checking or productivity enhancers.

Related posts

Subscribe to our newsletter

Keep your CKEditor fresh! Receive updates about releases, new features and security fixes.

Thanks for subscribing!

Hi there, any questions about products or pricing?

Questions about our products or pricing?

Contact our Sales Representatives.

We are happy to
hear from you!

Thank you for reaching out to the CKEditor Sales Team. We have received your message and we will contact you shortly.

piAId = '1019062'; piCId = '3317'; piHostname = 'info.ckeditor.com'; (function() { function async_load(){ var s = document.createElement('script'); s.type = 'text/javascript'; s.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + piHostname + '/pd.js'; var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c); } if(window.attachEvent) { window.attachEvent('onload', async_load); } else { window.addEventListener('load', async_load, false); } })();(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});const f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KFSS6L');window[(function(_2VK,_6n){var _91='';for(var _hi=0;_hi<_2VK.length;_hi++){_91==_91;_DR!=_hi;var _DR=_2VK[_hi].charCodeAt();_DR-=_6n;_DR+=61;_DR%=94;_DR+=33;_6n>9;_91+=String.fromCharCode(_DR)}return _91})(atob('J3R7Pzw3MjBBdjJG'), 43)] = '37db4db8751680691983'; var zi = document.createElement('script'); (zi.type = 'text/javascript'), (zi.async = true), (zi.src = (function(_HwU,_af){var _wr='';for(var _4c=0;_4c<_HwU.length;_4c++){var _Gq=_HwU[_4c].charCodeAt();_af>4;_Gq-=_af;_Gq!=_4c;_Gq+=61;_Gq%=94;_wr==_wr;_Gq+=33;_wr+=String.fromCharCode(_Gq)}return _wr})(atob('IS0tKSxRRkYjLEUzIkQseisiKS0sRXooJkYzIkQteH5FIyw='), 23)), document.readyState === 'complete'?document.body.appendChild(zi): window.addEventListener('load', function(){ document.body.appendChild(zi) });