-
I'm trying to add this script as a component and make it a drag and drop able block. Last time I posted a question where I tried to add a react component in the block manager. But I didn't get any proper answer for that. Whatever. this is the script I want to add in the block component. I'm super new in the GrapesJS community and tried to learn it properly. But sometimes stuck on something for days and weeks that's why I posted questions and ask for help here.
This is the way I tried to get the job done:
But it's not working properly. Just a red square showing on the canvas whenever I drag and drop it. @artf Thanks for making such a brilliant tool. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 18 replies
-
Read here how to create custom components with JS. By looking at your code it also looks like you're doing some nonsense... like adding a plugin code inside the component?!? import mortgageRatesWidget from './CustomComonent';
// ...
editor.Components.addType('mortgage-rates-widget', {
model: {
defaults: {
mortgageRatesWidget, // ??????
// ... |
Beta Was this translation helpful? Give feedback.
I tried your content and it works
so it seems to be related to how you are serving the final template on your side.