GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.38k stars 4.06k forks source link

[QUESTION] Onload event inside template #1123

Closed alfaalex81 closed 6 years ago

alfaalex81 commented 6 years ago

Hi! I have a problem with some templates. This template has some scripts running after the page is loaded. When this templates is loaded by GrapeJs, the scripts do not starting because browser not detect the ending of load.

It's possibile to load templete in a classic iframe (not injected)?

For example: <iframe src="http://myexamplepages.com" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>

It is possible to use this solution or you can suggest other one.

Thanks.

artf commented 6 years ago

Have you tried with this?

const editor = grapesjs.init({
    ...
    allowScripts: 1,
});
alfaalex81 commented 6 years ago

Sure, other scripts with "allowScripts" parameter work fine, but scripts inside "on load event" don't.

I inject the code in this way:

var newComps = editor.DomComponents; $.get('http://myexamplepages.com', function (e) { newComps.setComponents(e); }); window.editor.setComponents(newComps);

Thanks.

artf commented 6 years ago

@alfaalex81 can you provide a live demo of the issue?

no-response[bot] commented 6 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.