Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Entity Usage 5.0.0 Major update available for module entity_usage (5.0.0). Release: Entity Usage 8.x-2.3 Minor update available for module entity_usage (8.x-2.3). Release: Excel Serialization 2.2.0 Minor update available for module xls_serialization (2.2.0). Release: TMGMT DeepL Integration 2.4.2 Minor update available for module tmgmt_deepl (2.4.2). Release: Disable Login Page 1.2.0 Minor update available for module disable_login (1.2.0). Release: Akamai 5.1.1 Minor update available for module akamai (5.1.1). Release: GraphQL 5.1.0 Minor update available for module graphql (5.1.0). Release: agGrid 8.x-1.8 Minor update available for module aggrid (8.x-1.8). Usage Milestone: Easy Email Module easy_email crossed 10,000 active installs. Module Revived: Gleap 1.0.6 Module gleap updated after 7 months of inactivity (1.0.6).

CKEditor Text Selection

5 sites Security covered Drupal 10–11
View on drupal.org

This module preserves your text selection and cursor position when switching between WYSIWYG and source code modes in the CKEditor 5 editor. It also ensures the selected text stays visible by scrolling it into view in both editing modes.

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.

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.

Depends on

Dependencies of the latest stable release

  • ckeditor5 Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
May 2026
Latest release
2 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.1 Stable 10–11 Jun 27, 2026
1.0.x-dev Dev 10–11 May 3, 2026
1.0.0 Stable 10–11 May 3, 2026