FEAT: Disable scripts on canvas
Question
Hello, first of all thanks for a great tool.
On my project i hit the problem where I need to disable scripts inside the editor. I found 2 similar issues with this problem - https://github.com/artf/grapesjs/issues/2046 https://github.com/artf/grapesjs/issues/2814. So the problem is quite common and maybe it's better to add such feature to the next version?
In https://github.com/artf/grapesjs/issues/2046 issue @sdrebel mentioned that he's removing scripts in canvas and running them only in preview mode. Can someone prompt how to do it, I didn't find a way how to remove and set js for the template.
Answers (3)
Hi @kuhelbeher I'm still trying to achieve that too, but here's a tip that can help us to achieve it. I'll post here if I figure out a way. See this issue #2772
@RJCAM thanks for tip, I tried that, but problem with this approach is that it disables script for component, not the whole template.
Once the editor and its components are loaded it's hard to think about disabling JS, think about a component with custom scripts that binds events all around the DOM (maybe even using some external plugin).
The only way it could be possibly done is to reload the entire Frame (with the current components state), once some configuration flag (eg. via Canvas.enableScripts(false)) is updated, and prevent their append here.
PRs are welcome :)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1368
Resize canvas
Is there a way to have a dynamic resizing of the canvas? i.e not using the Device Manager, but having a drag and drop of the width, similar...
Issue #3558
FEAT: Support Content-Security-Policy
To reduce the possible attack surface if the editor is used in "hostile" environments (e.g. in SaaS platforms) support for CSP is required....
Issue #3857
BUG: Firefox issue when the user clicks on different component very fast
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? FirefoxReproducible demo link https://grapes...
Issue #1791
Name of the destination
@artf, Is there any way to show the name of the destination element ?
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.