Calling a function which is outside the component same as explained in issue #395
If you want a function attached inside the string you have to pass a string
Read full answer below āQuestion
I am calling a function which is outside the component same as explained in issue #395 but it is returning a string instead of a function I want to call defaults.drawGauge function in script and pass the id that is created dynamically I am stuck please help me out grapesjs.plugins.add('liquid-gauge-plugin', function(editor, options){ let defaults = { // this function has to be called in component script drawGauge:function(id){ alert("draw" + id); } } for (let name in defaults) { if (!(name in options)) options[name] = defaults[name]; } var domComponents = editor.BlockManager; domComponents.ad...
Answers (3)
If you want a function attached inside the string you have to pass a string
drawGauge: `function(id){
alert(1);
}`
Sorry @artf i didn't understood what exactly you are saying, can you please elaborate? Here i want to call the function ("drawGauge" which is in 3rd line) in domComponents script function. Please explain related to the problem given above. Thanks for your help. please help in this as it is very cri...
Inside your script property, {[ d ]} will be replaced with a d property of the componet and it can't be a function, so if your final result should be like this: you have to set a string for d
Related Questions and Answers
Continue research with similar issue discussions.
Issue #395
How to call a function which is outside the component in script function of component.
Please help in solving the below issue. How to call a function which is outside the component in script function of component. ex: demo.myF...
Issue #358
Calling updateScript from the script section of a pluging
Hi guys, I've been stuck for a few hours trying to figure out how to call updateScript from the script section of a custom plugin. So far I...
Issue #1370
Need to change Grapes Js Dynamic ID selector.
Its not a issue,I need some help. I have integrated Grapes Js with Drupal 8, for styling Drupal elements. I don't want the id selector whic...
Issue #1409
Component Drag Event
I want to know how can I get that component from which element is dragged and drop to the other component. I need to add a class if compone...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins āPremium plugins ship with support, regular updates, and production-ready features ā save days of integration work.
Browse premium plugins āRelated tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.