Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). symfony_mailer 2.0.0 Major update available for module symfony_mailer (2.0.0). editoria11y 3.0.1 Minor update available for module editoria11y (3.0.1). geofield_map 11.1.9 Minor update available for module geofield_map (11.1.9). domain 3.0.0 Major update available for module domain (3.0.0). ai 1.2.15 Minor update available for module ai (1.2.15). ai 1.3.4 Minor update available for module ai (1.3.4).

CKEditor Text Selection

A Drupal module that integrates the CKEditor 5 Text Selection plugin into Drupal's CKEditor 5 editor.

Demo

This module makes the editor keep its text selection when switching between WYSIWYG and Source mode, and scrolls the selection into the viewport. It replicates the behaviour of the popular CKEditor 4 Text Selection addon for CKEditor 5.

How it works

When switching from WYSIWYG to Source mode, the plugin maps the current cursor position or text selection from the editor model to the corresponding position in the raw HTML source. When switching back from Source to WYSIWYG, it reads the cursor position in the source textarea and restores it in the rich text editor.

All failures are handled silently — the editor never crashes.

Features

  • Preserves cursor position when toggling between WYSIWYG and Source editing modes.
  • Preserves text selection (not just cursor) across mode switches.
  • Scrolls the viewport to show the selection in both modes.
  • Works with the CKEditor CodeMirror Source Editing plugin.
  • Inspired by the CKEditor 4 Text Selection plugin.

Requirements

  • CKEditor 5 Source Editing must be enabled in the text format configuration.

Installation

  1. Install the module as you would normally install a contributed Drupal module. See Installing modules for further information.
  2. Go to Administration > Configuration > Content authoring > Text formats and editors.
  3. Configure a text format that uses CKEditor 5.
  4. Under CKEditor 5 plugin settings, enable the Text Selection plugin.
  5. Make sure Source Editing is also enabled in the toolbar.

Configuration

No additional configuration is required. Once enabled, the plugin automatically preserves text selection when switching between editing modes.

Related projects

Maintainers

DrupalBook agency created CKEditor Text Selection for Drupal and specializes in building clean, reliable CKEditor plugins tailored to real editorial workflows. If you need a custom CKEditor feature, deeper Drupal integration, or long‑term maintenance by someone who knows both ecosystems inside out, We are happy to help. Get in touch to discuss your project: [email protected] or https://drupalbook.org/contact.

Activity

Total releases
2
First release
May 2026
Latest release
13 hours ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
1.0.x-dev Dev May 3, 2026
1.0.0 Stable May 3, 2026