Issue #816Opened January 29, 2018by arthuralmeidap3 reactions

[QUESTION] Adds image block trough Editor API

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)

arthuralmeidapFebruary 7, 20182 reactions

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, 20181 reactions

@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 worked fine!

Why the active event is not triggered internally when we call the editor.addComponents method?

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.