Issue #816✓ SolvedOpened January 29, 2018by arthuralmeidap3 reactions

Adds image block trough Editor API

Quick answerby arthuralmeidap2

yes, you are right @artf . I didn't think about dumb cases like that you mentioned. It worked very fine to me. I just thought if was not the case to embedded such behaviour within the addComponents or somewhere else. Thanks for all the help btw! Closing the issue in 3, 2, 1.....

Read full answer below ↓

Question

Hi @artf ,

When I drag and drop a Image block within the canvas it triggers the active event for the image block thats runs the openModal method. Shows a modal to upload the image. I'm trying to run editor.addComponents({ type: 'image' }); and shows the modal to upload the image.

I didn't find any API methods that provides such functionality. Am I missing something?

If GrapesJS doesn't provides that, what do you think if I try to improve the editor.addComponents to check the component type and triggers the active event?

Answers (3)

👍 Most helpfularthuralmeidapFebruary 7, 2018

yes, you are right @artf . I didn't think about dumb cases like that you mentioned. It worked very fine to me. I just thought if was not the case to embedded such behaviour within the addComponents or somewhere else.

Thanks for all the help btw! Closing the issue in 3, 2, 1.....

arthuralmeidapJanuary 30, 2018

@chiqui3d, thanks for the feedback but the image block was just an example. In my case I have created a new Type and I was trying to trigger the active event for my component. It works exactly like the image block that's why I used the image block as an example. @artf, thanks for the response! it w...

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.