Problem/Motivation
CKEditor 5 was added to core in 9.3.0. Because ckeditor 5 was a ground-up rewrite all plugins must also be rewritten.
Proposed resolution
When migrating from ckeditor 4 to 5 we should consider using Custom widgets.
We should remove the fakeobject plugin and use Custom Widgets.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | ckeditor_iframe-3314483-20.patch | 208.52 KB | el7cosmos |
Issue fork ckeditor_iframe-3314483
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
mpp commentedComment #3
mpp commentedComment #4
mpp commentedComment #5
wim leersI asked the CKEditor 5 team what they recommend. They said:
Comment #6
smustgrave commentedJust following up about what the plan is going forward?
Could we maybe get a beta release for D10 with the old plugin while the ckeditor5 plugin is being worked on?
Comment #7
code_brown commentedI have used https://www.drupal.org/project/ckeditor_html_embed after removing the php 8.0 requirement and it suits our iframe embed needs, just make sure you have allowed iframe under "Ckeditor5 plugin settings" > "Source editing", on the "Text formats and editors" > "Configure" page.
The module uses the ckeditor5 html-embed plugin.
Comment #8
scott_euser commentedFor one client we had Media to support iframe embeds, but some legacy migrated content still had iframes directly in the html source. Switching to CKE5 stripped out the iframes. What we did is created a file like:
mymodule.ckeditor5.yml
This is identical to one entry in the ckeditor5.ckeditor5.yml in core with the
<iframe>and<iframe style ... etc>lines added withinelements:.After a cache clear, this automatically adds
<iframe src title width height frameborder scrolling allow allowfullscreen loading name sandbox>to the allowed_html and the iframe remains.We then instructed the client that if they wish to change the iframe, they should remove it and use the Media embedding options (in this case, the vast majority being covered by oembed).
Hope this helps someone else.
Note that I have not considered whether this might have security implications if you have untrusted users who might be adding untrusted iframe embeds.
Comment #9
jpsalter commentedThe yml file solution worked perfectly. Thank you.
Comment #11
o_timoshchuk commentedComment #13
o_timoshchuk commentedCreated the D10 & CKEditor 5 compatible version.
Comment #14
bobi-mel commentedHi @o_tymoshchuk.
I checked your changes. Everything works fine.
Comment #15
smustgrave commentedTested MR but it doesn't seem to be saving any of the values after save
Comment #16
o_timoshchuk commentedComment #17
smustgrave commentedSorry let me give better steps
Added button to ckeditor toolbar
Cleared cached
Verified button appears
Verified form appears
Inputting values seem to try and do something, Was using ESPN so might off been blocked
Clicked save
See the space of the iframe
Go back to edit.
Clicking edit iframe all the values previously there are missing.
Comment #19
el7cosmosAdded a commit to populate the form's field with existing values.
Comment #20
el7cosmosattaching static patch for composer
Comment #21
sarathkp commentedI have tested the functionality on my D10 setup and found this patch to be working as expected. The field values are getting populated with the values previously saved. Hence, marking the same as RTBC.
Comment #22
damondt commentedCan confirm this works
Comment #23
ewehbe commentedHello,
After all these changes I still have a JS error in my editor while using the IFrameEmbed
"TypeError: Cannot destructure property 'parent' of 'e.getFirstPosition(...)' as it is null."
Can someone help me fix this issue ?
Comment #24
el7cosmosAdded a commit to disable the button in source editing mode
Comment #26
bkosborneThe old CKE4 plugin would automatically adjust its UI so only attributes that were supported by the text filter were shown as available. I made changes to the CKE5 merge request to support something similar. Now there is a config form in the filter settings, allowing you to toggle which attributes should be available. This will sync with Drupal's allowed html filter format as well.
I haven't done a ton of testing with this yet, but it seems to be in a pretty good state. I think it makes sense to put this in a new 3.x branch. Should be able to support both the CKE4 and CKE5 plugins at the same time though. I'll work on that.
Comment #27
bkosborneComment #28
bkosborneSince I don't anticipate there being a ton of activity here, and since I suspect people will be eager to try this out, I'm going to commit this MR to the new 3.0.x branch and perhaps put out an alpha release of it. We can handle further fixes in a new issue and MR.
Thank you all for helping, especially o_timoshchuk and el7cosmos
Comment #31
firfin commentedThanks for fixing this, no more fakeobjects or ckeditr(4) needed!
Another step closer to getting sites working on D11!
Comment #32
firfin commented