After updating to latest Drupal 10.0.6 (which introduces a new release of ckeditor5) ckeditor5 doesn't work anymore when the Editor Advanced Link plugin is enabled.
The problem is reproducible on a clean Drupal 10.0.6 installation with both 2.1.1 and 2.1-dev version of Editor Advanced Link.
The error logged on the browser console is:
TypeError: this.editor.plugins.get(...).formView is null
_changeFormToVertical https://example.ddev.site/modules/contrib/editor_advanced_link/js/build/editorAdvancedLink.js?v=10.0.6:1
init https://example.ddev.site/modules/contrib/editor_advanced_link/js/build/editorAdvancedLink.js?v=10.0.6:1
promise callback*./packages/ckeditor5-core/src/index.ts/init/p/< https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
p https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
init https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
initPlugins https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
create https://example.ddev.site/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=36.0.1:4
create https://example.ddev.site/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=36.0.1:4
attach https://example.ddev.site/core/modules/ckeditor5/js/ckeditor5.js?rs17v0:371
editorAttach https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:300
attach https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:224
attach https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:207
attachBehaviors https://example.ddev.site/core/misc/drupal.js?v=10.0.6:166
attachBehaviors https://example.ddev.site/core/misc/drupal.js?v=10.0.6:162
<anonymous> https://example.ddev.site/core/misc/drupal.init.js?v=10.0.6:32
listener https://example.ddev.site/core/misc/drupal.init.js?v=10.0.6:20
domReady https://example.ddev.site/core/misc/drupal.init.js?v=10.0.6:26
<anonymous> https://example.ddev.site/core/misc/drupal.init.js?v=10.0.6:31
<anonymous> https://example.ddev.site/core/misc/drupal.init.js?v=10.0.6:34
ckeditor5.js:427:19
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | 3350254-ckeditor-5-36-compatibility-23.patch | 15.16 KB | dwisnousky |
| #16 | 3350254-ckeditor-5-36-compatibility-16.patch | 15.01 KB | a.dmitriiev |
| #14 | Screenshot 2023-05-24 at 12.19.10.png | 28.83 KB | a.dmitriiev |
Issue fork editor_advanced_link-3350254
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jmouse888 commentedI can confirm the same error after Drupal 9.5.6 upgrade. (TypeError.... formView is null)
Also tried 2.1.1+1-dev and no luck. Same error.
Comment #3
mark_fullmerThe update to CKEditor5 that caused the issue, introduced in 9.5.6 and 10.0.6, has been reverted in https://www.drupal.org/project/drupal/releases/9.5.7 and https://www.drupal.org/project/drupal/releases/10.0.7
This issue should remain open for compatibility with 10.1.x, which retains the CKEditor update.
Comment #4
mark_fullmerNote the proximate trigger is
const linkFormView = this.editor.plugins.get( 'LinkUI' ).formView;, https://git.drupalcode.org/project/editor_advanced_link/-/blob/2.x/js/ck... , which returns a null value.Potential reference for refactoring: https://github.com/ckeditor/ckeditor5/issues/4836#issuecomment-1422740830
Comment #5
jmouse888 commentedConfirmed Editor Advanced Link 2.1.1 is working with Drupal 9.5.7.
Comment #6
finex commentedThank you very much!
Comment #7
wim leersI spent hours on this over at #3317769.
See #3317769-33: Add support for linking to entities in CKEditor 5 and https://git.drupalcode.org/project/drupal/-/merge_requests/2909/diffs?co... for the exact root cause + solution. That solution also removes one hack:
Comment #8
rajab natshahFacing the same issue with Drupal 10.1.0-alpha1
Thanks for your time and hints and following up on this issue
Comment #11
bbombachiniGot this started but it needs work and I don't have a lot of experience with ckeditor 5.
It does not prevent wysiwyg from loading as it was happening before, but the extra fields are not being added. I get errors about a deprecation on the console linking to this https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#erro...
Comment #12
bbombachiniComment #13
anybodyWe're facing the same issue with Drupal 10.1.0-beta1.
Having a look at the MR I have to admit I'm also very unsure how to solve this correctly for this case.
Comment #14
a.dmitriiev commentedI have tried the code from MR on Drupal 10.1.0-beta1 and it indeed fixed fatal error. Unfortunately for extra fields only "Open in new window" is displayed and not others.
Comment #15
a.dmitriiev commentedI think that the issue is now fixed in the MR. I moved everything inside the event listener for
set:visibleViewand it started working properly. Please review.Comment #16
a.dmitriiev commentedAlso uploading patch of the current MR state
Comment #17
breidert commentedI tested the patch #16 and it works for the properties Title, CSS classes, Open in new window, and in combination with Linkit module.
Comment #18
uber_denis commentedIn my case when I add the link button to CKEditor then the editor is not displayed.
After adding #16 everything seems to work as expected.
Comment #19
mgstablesAfter applying patch #16 the ckeditor5 still won't load. The Console shows the following error message:
Drupal 10.1.0-beta1
Advanced Link 2.1.1
PHP 8.1.6
Comment #20
robcarrThe patch at #16 worked for me: D10.1-beta1; PHP 8.1.6; Adv link 2.1.1; Chrome 113.0.5672.126
Note: I cleared Drupal cache and the browser cache
Comment #21
mgstablesYes, clearing the browser cache made it work. Thanks @robcarr.
Now patch #16 works for me too.
Comment #22
robcarrComment #23
dwisnousky commentedadding as physical patch to keep our codebase as safe as possible. Thank you for the fix, fam!
Comment #24
a.dmitriiev commentedHow is patch from #23 different from patch in #16?
Comment #25
anybodyPinged the maintainer. @Maintainer: Please note the RTBC was for Ptch #16
@a.dmitriiev or anyone else, would you like to update the MR with the patch contents from #16 to make it easier for the maintainer to merge?
Comment #26
zenimagine commentedHi, impossible to apply the patch on drupal 10.1 would you have a solution? THANKS
Comment #27
zenimagine commentedComment #28
zenimagine commentedSorry, error on my part, because I applied the patch to the kernel. I have now correctly applied the patch to the module, but it does not work. I have errors in the console and ckeditor does not load.
Comment #29
anybodyPatch works, the mistake is on your side. You have to patch drupal/editor_advanced_link not core. Like in #28.
Comment #30
zenimagine commentedI have applied the patch to the module and cleaned the cacahe but I have this error in the console and ckeditor does not load:
Comment #31
catapipperPatch works for me. Thanks for this, thought I was in real trouble when I tested the Drupal update today.
Comment #32
a.dmitriiev commented@Anybody the patch in #16 was created from MR, so they should be in sync.
Comment #33
a.dmitriiev commented@zenimagine it might be also the cache in the browser. Try to clear browser cache.
Comment #34
agoradesign commentedpatch #16 works for me on 10.1.0
Comment #35
bklineConfirming patch #16 works on D10.1.0 with linkit module.
Comment #36
zenimagine commentedThanks, it works. I had cleared cache in drupal but not in browser
Comment #37
ant1Not compatible with 2.1.2
Comment #39
duaelfrThank you all!
I reworked the patch on top of the 2.x branch and fixed the last issue.
Comment #40
jkamizato commentedI've moved to "need to work" because MR and patches can't be applied.
Comment #42
jkamizato commentedGuys, I've created a new branch
3350254-ckeditor-5-36-2and I've applied manually the patch #23. I'm uploading the new patch and I've updated the code.(Update, I'll hide the patch because still not applicable )
Comment #43
jkamizato commentedComment #44
a.dmitriiev commentedjkamizato you can't apply the patch, because it is already merged to the module and the new version was released.
Comment #45
carolpettirossi commentedMoving to Closed Fixed as it's been already merged and available in the release
Comment #46
agoradesign commentedfyi, "Fixed" status gets moved to "Closed (fixed)" automatically after 14(?) days :)