02 September 2019

N1ED Blog /

CKEditor modules in Drupal 8

This article shows how you can extend functionality of CKEditor in Drupal 8, and also explains peculiarities of Drupal 8 architecture and the official CKEditor module.

Text formats in Drupal 8

CKEditor is completely integrated to the existing editing mechanisms of Drupal. Whenever a user edits an HTML content in the edit box (be that just a comment or an article content), the CMS loads the editor corresponding to the given role of the user. If the role of the user permits several editing options, the combo box allows switching between them. In Drupal, each such editor option with all the associated settings is called the text format.

In order for a user (either authorized or anonymous) to use CKEditor in some textbox of a form, the following conditions must be met:

CKEditor plugins in Drupal

Unlike previous versions of Drupal, in 8th version you cannot simply copy a CKEditor plugin and then enable it in the config. The entire plugin connection process as well as extraPlugins config option control is automated and delegated to the CKEditor module.

The CKEditor module for Drupal finds all installed CKEditor add-ons in the system and plugs them in. So, to make the CKEditor module find a particular plugin, you should install the corresponding Drupal module first. Such a module is basically a wrapper for the plugin, and it simply tells the CKEditor module for Drupal what this plugin is and what settings it has. Also, it includes a component to visually configure these settings. Hence, connecting a CKEditor plugins that does not have a corresponding Drupal module is not possible. On the other hand, if the plugin is popular and is supported, it surely has a module, so this is a win-win situation.

It is worth mentioning that the module itself does not contain JavaScripts of the plugin. They should be copied manually to the libraries/ directory in the installation folder of the website. This is for a purpose and in compliance with the architecture of Drupal and the CKEditor module. Specifically, to allow you update the plugin independently of its module.

Install N1ED on your Drupal website

The easiest way to install N1ED is to use Installation Wizard. It will lead you through all these steps to the perfect editor on your website. Your first installation should be done using Wizard due to it will register a free API key for you.

Install now

If an article is useful, please share