Skip to content

start work on #3276563 "Meta create new"

This is an initial implementation of the CKEditor5 word count plugin for Drupal 9+.

It provides:

  • ckeditor5 integration
  • options for word count and character count

It does not fully implement all of the features in the ckwordcount module for use with CKEditor 4.

The approach follows the one demonstrated in the CKEDitor 5 Dev Tools module.

The CKEditor5 WordCountConfig interface provides only 4 properties:

  • container, an HTMLElement
  • displayCharacters, boolean
  • displayWords, boolean
  • onUpdate, function

We are able to pass displayCharacters and displayWords directly from Drupal, but not a raw javascript function or DOM element. Drupal would only pass these as strings.

To get the word and character counts to display, we can extend the standard javascript CKEditor5 WordCount plugin and add the container property directly to the plugin.

The plugin could be extended by also adding the onUpdate function.

Merge request reports

Loading