We are happy to announce the final release of CKEditor 4.1 with its groundbreaking new feature, Advanced Content Filter. After a successful stabilization phase following the release of CKEditor 4.1 RC we are really excited to publish this latest major release with a plethora of new features and a few fixes.
Advanced Content Filter (ACF)
The main feature that CKEditor 4.1 introduces is configurable input data filtering that we called Advanced Content Filter (ACF). ACF limits and adapts the data that is incoming to your editor to match the editor configuration that you have decided to use. What does it mean exactly? Let us first explain the two modes available in ACF.
Automatic ACF Mode
In automatic mode the filter is configured by editor features that you enable in your configuration — i.e. plugins, toolbar buttons, etc. Whatever content these features can produce and edit will be added as "allowed". Everything else will be stripped from the code by the editor as disallowed content.
The automatic mode is on when the
CKEDITOR.config.allowedContent option is not set in your editor configuration. This is the default setting which means that from now on by default all CKEditor contents will be filtered.
Custom ACF Mode
The filter can also work the other way round. You can manually configure which HTML elements, attributes, styles, and classes are allowed and the editor will adjust the features that are active and available to your users. This means that the user interface will only contain these toolbar buttons and dialog window tabs or even individual fields that support the content you explicitly allowed.
You can manually configure the allowed content by defining the
CKEDITOR.config.allowedContent option. For your convenience, Allowed Content Rules can be set in two formats: the compact string format and as object literals.
ACF also includes another powerful feature: It can convert all forms of one feature to a chosen, preferred one. How does it work? If, for example, you want to allow bold formatting in your editor instance and additionally, your preferred form that is added to the filter definition is the
<b> element, the editor will accept all other forms of bold text (using
<strong> or inline styles, for example) and convert them into
<b> elements. This will save you the need to define all such synonyms in the allowed content configuration and at the same time will unify your data to one preferred form.
We are very excited to offer all these features to you and to bring the editing experience to the whole new level. In order to make your introduction into CKEditor 4.1 smoother, we have created a few resources that can help you understand and fully appreciate the possibilities that Advanced Content Filtering can give you. Check the following for more information:
- The blog post introducing CKEditor 4.1 Release Candidate with a nice introduction into ACF, explaining why content filtering is exactly the thing you have been waiting for.
- The Advanced Content Filter chapter of the Developer's Guide.
datafiltering.htmlsample available in the
samplesfolder of each CKEditor installation package.
- The data filtering demo on our website.
What You Need To Do
Automatic content filtering will be turned on by default, so you must be aware that from now on, all editor content will be stripped of any elements that do not comply with your editor configuration and the features that you enabled. This is also the case with content added to your website or database in the past that you want to edit now by using the latest editor version. You should thus carefully examine your editor configuration and check whether all the features that you want to use are enabled. Once you are done with it, you can be sure that any rogue elements that might destroy your website layout or cause other undesired effects will be removed by the editor without any further effort on your part!
Furthermore, if you created any custom CKEditor plugins, you will need to modify them to comply with ACF. This is a one-time exercise, too, and we have created a guide that will explain how to do this.
Last but not least, remember that you can turn ACF off at any moment by setting
true. We do, however, hope that you will treat this as a last resort solution as we would not like you to skip a truly innovative feature that we are really proud of!
As explained in the CKEditor 4.1 RC post, this version brings a few other features and fixes, most notably:
- the shared spaces feature where one toolbar can be shared by multiple editor instances,
- source editing in inline mode,
<s>element for strike-through formatting,
- New CKEditor API elements: the
toHtmlevents as well as the
Check out the What's New? page for the full list of changes.
We are really enthusiastic about the new CKEditor version and in particular, about the Advanced Content Filter feature. The 4.1 Release Candidate brought us a lot of positive feedback (and some critique, too!), so we will be happy to hear from you and thankful for any suggestions that will help us improve this feature and tailor it to your expectations.
Please use the CKEditor Development site to report issues and suggestions through tickets.