Problem/Motivation
I used CKEditor 4 module of Core in the past. I switched to CKEditor 5. It works well, but leads to a major regression.
The HTML is now saved as a single line. This means that revision comparison (via Diff module) have become impossible. Every change you make leads to the single line HTML being different, and the entire line being highlighted as a difference. Good luck figuring out what has changed then.
I looked at CKEditor configuration, Diff configuration, but nothing seems to be there to solve this. Also, I checked the database, and the HTML is now really saved as a single line there, while before it was stored in multiple lines, matching what CKEditor shows when viewing the source of the content.
I reported this for the CKEditor 5 core module at https://www.drupal.org/project/drupal/issues/3351660, but there are no replies.
Steps to reproduce
Use CKEditor 5, create a node, then change the node, and compare the revisions with the Diff module.
Proposed resolution
An ideal solution would be to store in the database the multiline HTML that is also shown by CKEditor in its Source view, as it did with CKEditor 4. That is the aim of https://www.drupal.org/project/drupal/issues/3351660. Maybe the Diff community could way in there, to create more interest?
For the Diff module itself, it would be great if If the XML could be pretty printed, and then compared.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3361617-8.patch | 1.98 KB | ahhua |
| #7 | 3361617-7.patch | 1.76 KB | leo liao |
| #3 | 3361617-1.patch | 1.83 KB | bingol@ciandt.com |
Comments
Comment #2
luke.leberHey @dhendriks - you might consider checking out https://www.drupal.org/project/diff_plus for some of the more bleeding edge support for things.
We ran into shortcomings and spun this up to work around things like HTML5 support, layout builder, etc.
The intention is to battle test some stuff and get them absorbed into diff proper, but we'll see :-).
Comment #3
bingol@ciandt.com commentedComment #4
dhendriks commentedI've been trying out Diff Plus for a few months, and I like it.
I also just tested the patch from #3, with Drupal 10.2.1, with Diff 8.x-1.1 and Diff Plus 1.0.0. It also works well.
Comment #5
bkosborneSee also #3351660: [DrupalHtmlEngine] CKEditor 5 saves content as single line HTML making revision diffing impossible which should help alleviate this a bit, by setting the default comparison method to strip tags.
Comment #6
acbramley commentedThis looks like something that needs to be fixed in core, not Diff.
Comment #7
leo liao commentedWe will continue to use this solution in 2.0.0 beta4 until a better solution is available.
Comment #8
ahhua commentedupdate the #3 patch for multi-language content.
Comment #9
pere orgaMoving it to Drupal core, as per #6
Comment #10
pere orgaActually, it is a duplicate of #3351660: [DrupalHtmlEngine] CKEditor 5 saves content as single line HTML making revision diffing impossible