var request = {};
          request['value'] = element.getOuterHtml();
          jQuery.ajax({
            url: Drupal.url('entity-embed/preview/' + editor.config.drupal.format + '?' + jQuery.param(request)),
            dataType: 'json',
            async: false,
            success: function (data) {
              element.setHtml(data.content);
            }
          });
          return element;

Our ajax request only loads the HTML part of the response. If a rendered entity adds CSS or JS that isn't yet loaded on the node page, this will make it appear broken in the WYSIWYG preview. yched is going to helpfully provide us with an example of what he had to do to get those assets loaded.

Comments

yched’s picture

Assigned: Unassigned » yched

Will try do do that soon

berdir’s picture

yched’s picture

@Berdir: #2347469: Rendering forms in AjaxResponses does not attach assets automatically is about the (ajax / AjaxResponse) forms used to configure the embedded element.
This issue here is about the rendering of the actual embedded element, that currently does not use AjaxResponses / the ajax framework at all.

So, not related AFAICT - after we change "ajax-fetch the rendered embed" to use the ajax framework, it's possible that we bump into the same underlying bug than the configure forms currently hit, but I wouldn't really know in advance since I'm not sure what that bug exactly is :-)

yched’s picture

slashrsm’s picture

slashrsm’s picture

Status: Active » Fixed

Merged. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.