Problem/Motivation
Hi,
My site was working perfectly well with Drupal 10.3 and CKEditor 5
After updating the site to Drupal 10.4 the entire site still works fine but when I edit existing content the CKEditor Wysiwyg editor no longer loads. The error in the console is: (Also attached a screenshot)Uncaught TypeError: Cannot read properties of undefined (reading 'attach')
at Object.editorAttach (editor.js?v=10.4.0:304:37)
at editor.js?v=10.4.0:228:18
at Array.forEach ()
at Object.attach (editor.js?v=10.4.0:211:52)
at drupal.js?v=10.4.0:166:24
at Array.forEach ()
at Drupal.attachBehaviors (drupal.js?v=10.4.0:162:34)
at big_pipe.js?v=10.4.0:153:10
at big_pipe.js?v=10.4.0:184:3When I add new content the editor is loaded initially but when I want to edit that content or other content the editor does not load.
I have uninstalled the CKEDitor and re-installed and reassigned it to the text format. Did not help
I cleared my cache in case javascript files were cached. Did not help.So I'm stuck and hope someone can help.
#3294720: The attachBehaviors() for document is only called after Big Pipe chunks are processed
#3467860: Ensure consistent ordering when calculating library asset order
Steps to reproduce
Given that a Drupal 10 site was installed with the minimal profile ( not the standard profile )
And later on the BigPipe and CKEditor5, Tour modules were installed
Then the wight of the BigPipeJavaScriptlibrary will affect the CKEditor 5, Tour, Maybe other modules.
Big Pipe is attempting to attach behaviors too early, and it’s affecting the Tour module as well.
Proposed resolution
- Find a better way to Attach behaviors in Big Pipe
- Add
header: trueto thedrupal/big_pipelibrary. - Switch to use a custom domReady in the BigPipe script to let work as Drupal init to Attach behaviors early, if possible without errors
- Suggestion for further improvement: Have advanced config settings for BigPipe:
- Limit to selected themes - Example: only load in the front-end themes.
- Limit by user role - Example: only autonomous users.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | drupal-core--2025-01-02--3496329-32--mr-10753.patch | 3.46 KB | rajab natshah |
| #22 | drupal-core--2024-12-31--3496329--mr-10753.patch | 416 bytes | rajab natshah |
| Screenshot 2024-12-28 at 12.08.04.png | 96.46 KB | robbnl |
Issue fork drupal-3496329
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
rajab natshahFacing the same issue
Comment #3
cilefen commentedAre any CKEditor plugin modules installed on affected sites?
Comment #4
rajab natshahWhen I disable the BigPipe module, the issue disappears.
Comment #5
catchI can't reproduce this with the standard profile (ckeditor5 and big_pipe installed).
Can you try the following:
1. See if you can reproduce it on a clean install of Drupal 10.4 with only core.
2. As @cilefen says check if you have any ckeditor plugin modules installed and if so let us know which ones.
The most likely cause of this is #3467860: Ensure consistent ordering when calculating library asset order interacting badly with a (usually incorrect) contrib library definition. So a third step would be checking contrib library definitions to see if they specify weight for any files.
Comment #6
robbnl commentedHi,
Thanks for the responses. I don't have time the next few days to check this on a fresh install of 10.4.
What I can say is that for me also if I uninstall the bigpipe module I no longer have this problem and I can again use the editor.
I do not have any extra CKeditor plugins installed on this site
Comment #7
rajab natshah#3294720: The attachBehaviors() for document is only called after Big Pipe chunks are processed
#3467860: Ensure consistent ordering when calculating library asset order
Big Pipe is attempting to attach behaviors too early, and it’s affecting the Tour module as well.
Comment #9
rajab natshahHaving a look at the logic in drupal.init.js file
Defines a behavior to be run during attach and detach phases.
Attaches all registered behaviors to a page element.
in the drupal.js file
Comment #10
rajab natshahComment #11
rajab natshahComment #12
rajab natshahComment #13
rajab natshahComment #14
rajab natshahComment #15
rajab natshahComment #16
rajab natshahComment #19
rajab natshahComment #21
rajab natshahComment #22
rajab natshahAttached a static
drupal-core--2024-12-31--3496329--mr-10753.patchfile for the10.4.xto this point from MR10753.To be used with the Composer Patches
Comment #23
smustgrave commentedPossible to get a test case showing the issue.
Comment #24
rajab natshahFaced another issue when adding
header: trueto thedrupal/big_pipelibrary.The status message no longer appears on the site.
Comment #25
rajab natshahComment #26
rajab natshahSwitched to use a custom domReady in the BigPipe script to let work as Drupal init to Attach behaviors early, if possible without errors
Comment #27
rajab natshahComment #28
rajab natshahComment #29
rajab natshah-
Comment #30
rajab natshahComment #31
rajab natshahOps, uploaded the wrong static file name.
Comment #32
rajab natshahComment #33
rajab natshahAttached a static
drupal-core--2025-01-02--3496329-32--mr-10753.patchfile for the10.4.xto this point from MR10753.To be used with Composer Patches
Comment #34
rajab natshahComment #35
jaroslav červený commentedIt helped me with the problem
https://www.drupal.org/project/collapsible_dnd/issues/3497645
Comment #36
catchComment #37
mr.pomelov commentedDrupal 10.4.1. Patch #33 work for me
Comment #38
ericdsd commentedPatch #33 works perfectly on core 10.4.5, is there still a reason to to keep Needs work status?
Comment #39
catchheader: true means that big pipe will load a large amount of render blocking javascript, is that absolutely necessary to the fix here?
Ideally would come with test coverage but it might not be possible to reproduce consistently in a test?
Comment #40
jstollerI experienced this issue when using ACE Code Editor along with CKEditor5 on Drupal 11.2.2, and MR !10754 fixes it.
Comment #41
arnabcse2013Thank you @Rajab for the MR.
Infact in my opinion I agree with @catch to not use the "header: true" as that will use a huge amount of render for javascript. This way we are just forcing the script to load in the header just to satisfy(May be a temp solution).
FYI, the "collapsible_dnd" module is also impacted and it is not rendering the "draggable collapser" correctly.
https://www.drupal.org/project/collapsible_dnd/issues/3497645 -> The above patch from @Rajab for D10.4.x fixes the issue but creates additional errors in big_pipe.js in console and also stops showing the drupal msgs (I will try to some screenshots here).
I am working to find some solution and will update in both the places.
Comment #42
catchChanges always go into the development branch first.
Comment #43
cb_govcms commentedHave also experienced this where Big Pipe is affecting the loading of libraries in Claro: #3506870: Tabledrag misalignment and "Show row weights" link
Comment #44
rajab natshahComment #45
pixelpreview@gmail.com commentedThanks patch #33 works for drupal 10.6.7 too :)