Problem/Motivation

CKEditor 5 is in Drupal 10 core and making it's way in to Drupal 9 core via #3238333: Roadmap to CKEditor 5 stable in Drupal 9. This module needs to be updated to support CKEditor 5 without the CodeMirror addon as there are no plans to update it for CKEditor 5 (Compatibility with CKEditor 5.x?).

Proposed resolution

Develop a CKEditor 5 plugin directly in to the module that adds CodeMirror support to the CKEditor 5 SourceEditing plugin.

This work is underway in the 3.0.x branch.

Remaining tasks

  • Fix any issues with styles (borders missing in source edit mode)
  • Wire up configuration options
  • 4-to-5 configuration migration handling
  • Update tests
  • Determine if the CKEditor 5 plugin can/should be independent of the Drupal module

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Comments

matt_paz created an issue. See original summary.

matt_paz’s picture

Issue summary: View changes
matt_paz’s picture

Issue summary: View changes
matt_paz’s picture

Issue summary: View changes
matt_paz’s picture

Title: Add support for CKEditor 5 » Add CodeMirror support for CKEditor 5
wells’s picture

Thanks @matt_paz!

Per https://github.com/w8tcha/CKEditor-CodeMirror-Plugin/issues/176 it seems that the maintainer of the underlying plugin for CKEditor does not intend to port the CodeMirror plugin to CKE5 so we will need to create out own unless another option turns up somewhere.

matt_paz’s picture

Ya, I'd totally forgotten that I'd already filed an issue on w8tcha/CKEditor-CodeMirror-Plugin back in July. Unfortunately, I haven't run across anything similar for either ACE or CodeMirror (relative to support for CKE5). I haven't looked deeply tho. But yes, this may prove a heavier lift than one might have otherwise anticipated. I fear CKE5 might represent some interesting challenges for this plugin, but time will tell.

wells’s picture

Version: 8.x-2.x-dev » 3.0.x-dev

I'm fiddling in a 3.0.x with the prospect of implementing this more directly (i.e. without the generic CKEditor CodeMirror plugin). Not sure if it will really work out. It seems like it should be straightforward but I might be missing something.

Currently I've got it to a point where when CKE5 goes in to source edit mode this module's plugin uses a (global, from library) CodeMirror instance to replace the CKE5 source editing textarea. In it's current state the positioning is messed up and changes don't get saved (need to wire up an event for that apparently) but code does get highlighted!

I'm also looking at CodeMirror 6 but it removes the fromTextArea method that enables this in its current state. Understandably so because the performance is probably terrible for large sources. However if the current approach I'm trying doesn't really work a more complex implementation (essentially replacing source editing?) may be necessary anyway.

matt_paz’s picture

Not sure if the progress on this issue will help, but I thought I'd pass it along on the chance it might represent a part of the puzzle.

Automatically use CKE5's General HTML Support feature on text formats without any TYPE_HTML_RESTRICTOR filter + add `sourceEditing` button
https://www.drupal.org/project/ckeditor5/issues/3216021

  • wells committed f794642 on 3.0.x
    Issue #3243437: Implement full plugin with module
    
wells’s picture

Issue summary: View changes

I've got this basically functional in the 3.0.x branch now.

Things still TODO:

  • Fix any issues with styles (borders missing in source edit mode)
  • Wire up configuration options
  • 4-to-5 configuration migration handling
  • Update tests
  • Determine if the CKEditor 5 plugin can/should be independent of the Drupal module

  • wells committed 829a07a on 3.0.x
    Issue #3243437 by wells: Update existing tests for Drupal 10
    

  • wells committed 0929786 on 3.0.x
    Issue #3243437 by wells: Add SourceEditing-like custom styling to...
wells’s picture

Issue summary: View changes

  • wells committed 4879b8c on 3.0.x
    Issue #3243437 by wells: Implement configuration option handling (for...
wells’s picture

Issue summary: View changes

  • wells committed ecea0f5 on 3.0.x
    Issue #3243437 by wells: Configure supported addons, remove unsupported...
wells’s picture

Issue summary: View changes
wells’s picture

Issue summary: View changes

  • wells committed 3c1be94 on 3.0.x
    Issue #3243437 by wells: Add 4-to-5 settings migration handling
    
wells’s picture

Issue summary: View changes

  • wells committed b1f462b on 3.0.x
    Issue #3243437 by wells: Move plugin to external library
    
wells’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.