Closed (won't fix)
Project:
CKEditor5 Embedded Content
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
26 Aug 2022 at 13:28 UTC
Updated:
7 Oct 2024 at 15:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
nuezComment #4
wim leersComment #5
tlo405 commentedSo I'm actually still seeing this problem. So I have a custom plugin that adds a custom callout into the editor. This plugin contains a media field, so I have added a media field to the embedded content modal. Here is what the code looks like:
This was based on the example from here.
This works fine using ckeditor4...I can make a selection and it gets inserted right into ckeditor (the media ID is stored as an html attribute like this:
<callout data-image="media:1"></callout>. However in ckeditor5, when I go to submit the embedded content form, nothing happens. No errors in the console either. My media field is optional, so if I don't click the 'select media' button, everything is fine. The html gets inserted into the editor correctly and thedata-imageattribute is just blank. However, if I click 'select media' to open up the modal, then it breaks. Even if I immediately close the modal without making a selection, it still breaks. No HTML gets inserted into the editor.I tried the patches listed above, but no luck.
@nuez, any possible idea what could be happening here? I see on the module home page it says "Drupal cannot deal with multiple modals. This will become an issue if you use this text filter in a modal, or you open a modal from the Embedded Content plugin form (Say for selecting a media entity with the Media Browser)". I'm just wondering if you ever saw this working using the media browser?
Comment #6
irsar commentedI am using https://www.drupal.org/project/uswds_ckeditor_integration with the embed content. But when I click on the embed content icon, its showing the loading icon for a second but doesn't load the modal window with the dropdown. When I debugged I am seeing AJAX error as below,
nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /embedded-content/dialog\nStatusText: OK\nResponseText: Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /app/web/core/lib/Drupal/Component/Utility/Unicode.php on line 477\nDeprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /app/web/core/lib/Drupal/Component/Utility/Xss.php on line 69\n
Comment #7
milos.kroulik commentedIt looks like the patch from #3 no longer applies:
It looks like there should be a note on the project page, that nested modals issue currently can't be solved.
Comment #9
larowlanReroll for those using patches, also pushed updated MR
Comment #10
irsar commentedWith the latest patch we have to use the patch still, but the old patch is not working.
Comment #11
irsar commentedComment #12
larowlanThe attached in conjunction with #2741877-109: Nested modals don't work: opening a modal from a modal closes the original allows you to embed inside embeds. Tested 4 layers deep 🤯
Interdiff against #9
Comment #13
nuezThank you for the reroll!
As you know the nested modals issue is a very old issue affecting a lot of use cases. I've proposed a solution in that issue , that might have an API change, non breaking though, (https://www.drupal.org/project/drupal/issues/2741877#comment-13559133 and later)
The issue is already 3 years old, but i think my suggestion is still the approach of the subsequent rerolls in that same issue.
@larowlan do you think we can move that issue forward and see if we can land it in core?
I'll have a chat with wim leers on slack see if he can help as well
Cheers,
Comment #14
larowlanYep, keeping an eye on that one too.
I'm not sure stacked modals is a great idea but 🤷♂️
Comment #15
nuezI agree that stacked modals might be not be a great idea UI wise, but it is a reality that cannot be ignored imho, and for which there is no real alternative.
The offset canvas modal is a solution to one extra layer. Opening the ckeditor5_embedded_content in an offset canvas would solve some issues, but that means that you can't use it in a block body, since that one also opens in an offset canvas. Maybe we should make it configurable that it opens in either offset or modal. That could solve some use cases. I'll put it on the roadmap for 2.x.
Comment #16
larowlanRealised I left behind some cruft from an earlier attempt in the last patch, removed it
Comment #18
danielvezaI've rerolled the patch and pushed that straight to the MR
Comment #19
nuezThis issue is addressed in the embedded_content module which replaces this one. https://www.drupal.org/project/embedded_content