grapesjs-custom-code doesn't execute <script> from GrapesJS 0.16.30 and up
Question
grapesjs-custom-code work fine with script tag until GrapesJS 0.16.27, after this version, no script content is executed.
✔️ Editor init() option : allowScripts: 1
✔️ Plugin import : https://github.com/artf/grapesjs-custom-code/issues/11#issuecomment-724512902
Is it related to https://github.com/artf/grapesjs/issues/3244 ?
Answers (2)
hi very thanks for u r replay... yes exactly , after you are replay i tried with 0.16.27 custom blocks script is working as expected but in above versions than 0.16.27 while drag and drop custom block script executing as expected but after saving and reloading the template using editor.setComponents(html text as String ); html coming properly but script is not working. i absorbed that in script in place of ' < > like this type of symbols are replacing with browser understanding codes so i tried to deploy that html in browser its working fine but script not working locally while reloading saved template. kindly if any one have the solution for this in latest version help me to get out of this
Thanks
Hi @bgrand-ch probably you're talking about a fixed bug 😂 Main reasons why you should not let execute a random script from a user:
- Self-XSS
- We can't control the script if we execute it inside the editor, so, for instance, the user paste this
<script>document.body.innerHTML = "";</script>and the editor is broken.
Actually, there is an option that kind of indicates that is by design
placeholderScript | Content to show when the custom code contains <script>
Related Questions and Answers
Continue research with similar issue discussions.
Issue #980
[BUG] Related with task https://github.com/artf/grapesjs/issues/873
Hello, After restoring editor from db still have some part of bug present. It seems inside of script: function () traits will have old valu...
Issue #3419
FEAT: Event to hook into after editor.render has been executed
What are you trying to add to GrapesJS? As described in BUG: Panels "visible" attribute doesn't prevent panel rendering I tried to prevent...
Issue #792
Script property using function don't work with blocks
In Components & JS docs there's this example: This works perfectly. But I couldn't use a function instead of a string in script, as is said...
Issue #2101
selected content parent tag remove
https://github.com/artf/grapesjs/issues/906#issuecomment-381403858 I need to remove the html content from editor.getSelected(). Now I'm usi...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.