Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

CKEditor Text Selection

Security covered Under active development 8 sites

Part of the Ckeditor ecosystem · 110 projects

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.

Drupal 10–11

Ask your assistant about CKEditor Text Selection

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
4 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP 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