Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe being rendered strangely in the canvas view #37

Open
quentin-bettoum opened this issue May 21, 2024 · 0 comments
Open

iframe being rendered strangely in the canvas view #37

quentin-bettoum opened this issue May 21, 2024 · 0 comments

Comments

@quentin-bettoum
Copy link

quentin-bettoum commented May 21, 2024

Hello,

The issue described below can be reproduced on the official demo at https://grapesjs.com/demo.html

When I try to add an iframe in a custom code block, the view tends to replace the iframe by a div, which breaks the layout of the iframe. However, the model seems to have the correct iframe since it is shown correctly in the view code modal, or by using editor.getHtml().

For example, if I add this iframe which is an embed YouTube video:

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?si=m6l8dvLYog_PS9a4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

This is what the canvas view will use, parts of the iframe attributes are now on a parent div:

<div data-gjs-highlightable="true" id="i73h" data-gjs-type="custom-code" draggable="true">
  <div id="i5xd" data-gjs-type="video" draggable="true" allowfullscreen="" width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?si=m6l8dvLYog_PS9a4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" class="gjs-hovered">
    <iframe src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?" frameborder="0" allowfullscreen="true" class="gjs-no-pointer" style="height: 100%; width: 100%;"></iframe>
  </div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant