The Entity Browser integration in CKEditor only works if the Browser is using the "iframe" display.
Replication steps:
1. Download Entity Browser, Entity Embed, and Embed dev releases
3. Run drush si standard -y; drush en entity_browser_example entity_embed -y
4. Create a new Entity Embed button (see screenshot) using the second "Test entity browser for files" (we should name this one differently, machine name is test_files1)
5. Add the button to a compatible format
7. Go to a WYSIWYG editor, try to use the browser to upload a file
8. Nothing happens on submit
iFrames seems to work just fine.
Comments
Comment #2
slashrsm commentedThis will be very hard to fix since entity embed already operates in a modal. What about just filtering EBs using Modal display from the configuration dropdown?
Comment #3
samuel.mortensonEither that, or forcing all Entity Browsers displayed in CKEditor to use the iFrame display.
Comment #4
slashrsm commented#2727031: Don't use OpenModalDialogCommand for modals might be related.
Comment #5
JamesK commented#2727031: Don't use OpenModalDialogCommand for modals is the first step; it allows for both dialogs to be open at once. There are still changes required to entity_embed as well.
Comment #6
jelle_sThis is a temporary fix that forces the display plugin to an iframe. This way you don't have to create multiple entity browsers (one as a modal that doesn't auto-open for entity reference fields and one as an iframe that does auto-open for entity_embed). Feedback welcome.
Comment #8
jelle_sStrange. The fail seems unrelated to the patch? Or am I missing something?
Comment #9
jelle_sDoesn't seem to work yet... It opens de dialog and I see the entity browser as I expect, but when I select the entity and submit it does't do anything.
Comment #10
jelle_sI dove a bit deeper and this approach will not work. Each display plugin provides its own route, so creating one on the fly means that there's no route for it. While the modal does open this way (in an iframe) the iframe loads the wrong url (entity-browser/modal/... instead of entity-browser/iframe/...). Seems we'll have to fix the actual issue in stead of using a workaround like this.
Comment #11
marcoscanoShould we close this assuming that the clarification done in #2819871: Make it clear that Embed isn't compatible with Entity Browsers that use the 'Modal' display plugin is enough?
Comment #12
joelhsmith commentedI wish we could fix it. It causes a user experience problem. Clicking on a link to an entity opens the entire website in the iframe. So you end up with all the admin nav and the whole site displaying within a site. Its annoying to a developer but I think it would be very confusing to an end-user entering content. They would probably assume the site is broke.
Side note, I would like to share a work around to this user experience issue to help with the user experience. I suggest people unlink the Entity in the View. Then add View Edit Delete links in the View.

Change those new View Edit Delete to use Rewrite and choose "Output this field as a custom link". And for Target choose "_parent". This will open the Entity in a new tab instead of inside the iframe.

Comment #13
anybodyI agree that a solution would be very very helpful. For example when using Entity Reference fields, the "Modal" display is much better than the iFrame. But if we'd like to use the "same" Entity Browser for that and for Entity Embed we have do duplicate them all as iFrame which is bad for maintainability, usability and manual work...
Can someone sum up what has to be done to solve this? @Jelle_S perhaps? Do you still remember?
#2727031: Don't use OpenModalDialogCommand for modals has been solved in the meantime.
I can dig deeper into this, but it would be nice to have as much information as possible to save time...
Comment #14
jelle_sI never figured out what was the actual problem with the modal as I recall. What I tried in my patch is to force the iframe display in cases where the modal wouldn't work. I tried to document my findings here as much as I could but it's been a year so my memory of the actual issue is fuzzy to say the least.
Basically my patch was more of a workaround than an actual fix (and the workaround itself didn't work either).
Comment #15
anybody#2820188: [entity_browser] Errors when using a modal/standalone Entity Browser, because modal-in-modal does not work is related / duplicate.
Comment #16
a-fro commentedI agree that it's a duplicate. I also tested the patch at https://www.drupal.org/project/entity_embed/issues/2820188#comment-11994341 and confirmed that it resolves the issue.
Comment #17
a-fro commented@marcosano and I discussed this solution along with the patch at https://www.drupal.org/project/entity_embed/issues/2820188. Patch #6 above is interesting, but we're a bit concerned that it hides the issue from the site builder. Transparency seems better (you cannot select an entity browser with a modal rather than swapping it out on the fly), which the other patch provides.
Comment #18
wim leersPer #15 and #2820188-28: [entity_browser] Errors when using a modal/standalone Entity Browser, because modal-in-modal does not work. I've explicitly quoted #2 and #17 in that comment. Thanks everyone!