Issue #395💬 AnsweredOpened October 9, 2017by suchithmahadi0 reactions

How to call a function which is outside the component in script function of component.

Quick answerby artf

You'll find the answer here #358

Read full answer below ↓

Question

Please help in solving the below issue. How to call a function which is outside the component in script function of component. ex: demo.myFunction function should be called in component script, but script is not able to recognize demo variable. Where as demo.myFunction can be called in init function. grapesjs.plugins.add('my-plugin', function(editor, options) { var demo = { this.myFunction(id){ alert(this.id); } } var domComponents = editor.BlockManager; domComponents.add('my-block', { id: 'myComp', label: 'Custom', category: 'plugin', attributes: { class: 'fa fa-square-o' }, style: { padding...

Answers (2)

artfOctober 9, 2017

You'll find the answer here #358

lock[bot]September 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.