Issue #1472Opened October 2, 2018by detectedstealth3 reactions

[QUESTIONS] Custom Code block and JS

Question

Wondering if there is a limitation or is it actually possible to create a block that allows the user of the editor to write custom javascript code as they are building the template? For example drag and drop a custom code block and write the javascript in it?

Example: I created a link and wanted to capture the click event to make an Ajax request etc... I know it is possible to update the editors initialization code to include an external javascript file but ideally we would like this to be handled dynamically in a single place without having to edit settings every time we add a new javascript function.

Answers (3)

cjpollardOctober 3, 20182 reactions

Try grapesjs.init({ allowScripts: 1, ... });

cjpollardOctober 3, 20181 reactions

That just means you won't see the code, but you get something to see and click on to edit it. The JavaScript itself is there and works just fine.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.