Open HitmanInWis opened 5 months ago
The approach of checking the parent edit context for whether the interface is in Edit mode is a result of the HTML in the embed.html
file of the embed
component forcing wcmmode=disabled
on including the embeddable
resource.
<sly data-sly-test="${embed.embeddableResourceType}"
data-sly-resource="${resource.path @ resourceType=embed.embeddableResourceType, wcmmode='disabled'}"></sly>
Why wcmmode=disabled
is forced, I'm not sure. There could have been a concern that by allowing the child embeddable to see the edit mode, editing the component would launch the embeddable's dialog instead of the general embed
dialog, but that doesn't happen b/c the resource in the JCR never changes type (it is always the parent embed
type) and thus opens the embed
dialog. I'm not sure why else. I tried removing this for the youtube
embeddable and everything seems fine.
If we remove wcmmode='disabled'
from embed.html
when including an embeddable, then the logic in YouTubeImpl
can simply check WCMMode, which then works correctly on both page load and after dialog is closed.
Note that the cause of this issue is similar to https://github.com/adobe/aem-core-wcm-components/issues/2785 - both could probably be solved with a solution that captures the original WCM Mode in a request attribute.
Bug present as of version: 2.24.7-SNAPSHOT
There is logic in the Youtube Embeddable to prevent the autoplay parameter from being used when in author Edit mode. The logic check is in the
YouYubeImpl
sling model that checks for the presence of the component's parent's edit context, which is returning null on component refresh after the dialog is closed. This results in a bug where the video is autoplaying in author mode until the page is refreshed (on page load the check works correctly).