Problem/Motivation
run Drupal 10 with both Ckeditor5 and/or ckeditor4 and we want to do so without losing ckeditor4 functionality such as codemirror markup (we love codemirror!).
Features
Codemirror with Drupal 10 for ckeditor4 which does not interfere with codemirror support for Drupal 10 ckeditor_codemirror with ckeditor5. This module is for those that want to have codemirror for ckeditor4 and still use ckeditor_codemirror 3.x which only supports ckeditor5 so you end up with two modules ckeditor4_codemirror and ckeditor_codemirror 3.x.
see patch:
https://www.drupal.org/files/issues/2023-06-12/wxt5-3362801.patch
New module solves this:
forked ckeditor_codemirror 2x into ckeditor4_codemirror , fork required some attention to details but is working as expected.
https://drupal.org/project/ckeditor4_codemirror
see upstream
#3362797: ckeditor 4 and ckeditor 5 support simultaneously?
Steps to reproduce
#3362797: ckeditor 4 and ckeditor 5 support simultaneously?
Proposed resolution
#3362797: ckeditor 4 and ckeditor 5 support simultaneously?
Remaining tasks
#3362797: ckeditor 4 and ckeditor 5 support simultaneously?
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | wxt-codemirror-support-cke4-cke5-3362801-20.patch | 546 bytes | smulvih2 |
| #8 | wxt5-3362801.patch | 2.19 KB | joseph.olstad |
Comments
Comment #2
joseph.olstadblocked on #3362797: ckeditor 4 and ckeditor 5 support simultaneously?
Comment #3
joseph.olstadperhaps the easiest way would be to fork the 2.x version of this project into a ckeditor4_codemirror project and install both this module for ck5 and the forked one for ck4 at the same time.
This would be the easiest thing to try first! I will try this soon hopefully!
Comment #4
joseph.olstadI'll get to this hopefully in the next 72 hours
Comment #5
joseph.olstadhttps://www.drupal.org/project/ckeditor4_codemirror/releases/1.0.0-alpha1
it's working but I'll polish it up soon, needs likely manual path renames and path fixing for the libraries
Comment #6
joseph.olstadDrupalcon 2023 contribution, ckeditor4_codemirror
Comment #7
joseph.olstadComment #8
joseph.olstadsee patch
Comment #9
joseph.olstadMight also need something in site-wxt, hoping @smulvih2 can review this.
Comment #10
joseph.olstadComment #11
joseph.olstadComment #12
joseph.olstadHmm, this isn't quite ready, when using ckeditor 5 and ckeditor 4 at the same time and installing ckeditor4_codemirror ^1 and ckeditor_codemirror ^3 , ckeditor5 will crash and not load, some js errors, some sort of conflict to resolve.
Comment #13
joseph.olstadand
#3362797: ckeditor 4 and ckeditor 5 support simultaneously?
Comment #14
joseph.olstadComment #15
sylus commentedI talked with @smulvih with this and I think to limit the maintenance and potential problems we just want to go pure CKeditor 5 and address any problems as they arise.
I believe we are close for Drupal 10 and this should be feasible for CKEditor 5.
I hope this is ok any makes sense although I appreciate that this issue was filed so others know they can do both should they choose.
Comment #16
sylus commentedComment #17
sylus commentedOk @smulvih2 talked to me a bit more and I think we agreed that sadly this is probably the best way forward to get people on Drupal 10, and push any content issues in CKEditor 5 to a later release. All of our plugins do work in both CKEditor 4 and 5 except for codemirror in CKEditor 4 which this ticket addresses.
As long as we set a timebox and don't end up support CKEditor 4 for longer then we should then I'm ok with this. :)
Comment #18
joseph.olstadckeditor4_codemirror is working well for us, I updated the installation instructions on the project page.
I will have to double check again to see how well it's working in harmony with ckeditor 5
Comment #19
smulvih2I was able to get working in CKE4, but get an error in console for CKE5:
I just added the following to the require section of composer.json, didn't have to use the merge plugin:
Comment #20
smulvih2I was able to get codemirror working with cke4/cke5 simultaneously, patch attached. I was getting the error when the Source button is not added to CKE5. Once I added the Source button to my new CKE5 text format it works as expected. I can toggle content between CKE4 and CKE5 and get codemirror in both.
Would like to run some more tests against this, like upgrading D9->D10, and fresh install of D10.
Comment #21
joseph.olstadok so I just re-tested ckeditor4_codemirror on a wxt5/D10.0.10 site that has ckeditor 4 , I enabled the ckeditor 5, configured a new text format with ckeditor5 as a wysiwyg
both code mirror in ckeditor 4 and code mirror in ckeditor 5 are working this way.
The way to make this happen is to install and set up the ckeditor4_codemirror module according to the project page installation instructions https://drupal.org/project/ckeditor4_codemirror
This way both ckeditor4 AND ckeditor 5 are able to work correctly with code mirror no conflicts.
I forked the ck4 ckeditor_codemirror branch over into a new project, massaged everything and it's tested , success.
no conflicts with ckeditor_codemirror
Install and configure ckeditor4_codemirror
1. Download and install CKEditor4 CodeMirror module.
composer require drupal/ckeditor4_codemirror2. Install the CKEditor-CodeMirror-Plugin library
For Composer-managed Drupal installations, the recommended method is to use
the Composer Merge Plugin and this module's composer.libraries.json file. From a Composer project root:
a) Execute
composer require wikimedia/composer-merge-plugin.Add the following to the extra section of the root composer.json
file:
Note: Remember to replace
{DOCROOT}with the appropriate root folder for the Drupal installation -- this is likelywebor docroot orhtml.c) Execute
composer install(or, in some cases, composer update --lock).d)
composer require "w8tcha/ckeditor-codemirror":"*"Post-Installation
Comment #22
joseph.olstad@smulvih2 , I was saving my comment after you put yours in,
yes that plugin and module does the trick, no conflict!
Comment #23
smulvih2Yep, and don't need the merge plugin to get working. If you were to add "w8tcha/ckeditor-codemirror" to the composer.json for your module then only one require would be needed for WxT. I added a patch for this here - https://www.drupal.org/project/ckeditor4_codemirror/issues/3380761#comment-15189687
Comment #24
sylus commentedI got this working and am now calling @joseph drupal module, but for the w8tcha/ckeditor-codemirror I just added it to composer-extdeps as we did for the earlier version to keep things clean. I also took the 1.18.5 version of codemirror which is closer to what we are shipping supporting "codemirror": "^5.65.5"
Comment #25
joseph.olstadya whatever works, as long as it works and looks good, great :)
That merge plugin is from the ckeditor_codemirror instructions, maybe we already have something similar or that functionality is included now in composer by default, not sure.
Comment #26
joseph.olstadWow thanks @smulvih2 for the patch , I'll make a new release of ckeditor4_codemirror with patch from @smulvih2
#3380761: Require w8tcha/ckeditor-codemirror
new release coming right up
Comment #27
joseph.olstadhttps://www.drupal.org/project/ckeditor4_codemirror/releases/1.0.1
Comment #28
joseph.olstadok this simplifies the require process, let me know how this works for you @smulvih2 / @sylus
Comment #30
joseph.olstadOk I'll publish release 1.0.2 right away that will specify the
^1.18.5version of the library instead of^1.16.0This way it should avoid a conflict when doing
composer upComment #31
sylus commentedI think you need to revert the patch that @smilvih provided in the other repo since this only works in wxt because that version and others is defined in composer-extdeps.
How your module worked before is the correct way for people using the merge plugin, we just don't need it because we have our own composer registry which push this stuff but others won't have that.
https://github.com/drupalwxt/composer-extdeps/commit/ea80c3339ff6da7bb84...
Comment #32
sylus commentedSo just revert this:
https://www.drupal.org/project/ckeditor4_codemirror/issues/3380761
But then in your composer.libraries can update to 1.18.5 if want to target close to the codemirror library. :D We use.
Closing this issue out :)
Committed and attributed!
Comment #33
joseph.olstad@sylus, ah oops ok I'll revert and re-tag, thanks for the heads up
Comment #34
joseph.olstadhttps://www.drupal.org/project/ckeditor4_codemirror/releases/1.0.3
Comment #36
joseph.olstad