Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: "component:add" event triggers when components are moved #868

Closed
nojacko opened this issue Feb 14, 2018 · 9 comments
Closed

[BUG]: "component:add" event triggers when components are moved #868

nojacko opened this issue Feb 14, 2018 · 9 comments

Comments

@nojacko
Copy link
Contributor

nojacko commented Feb 14, 2018

Taken from https://github.com/artf/grapesjs/wiki/API-Editor

component:add - Triggered when a new component is added to the editor, the model is passed as an argument to the callback

My understanding is that the component:add should only be called when the block is dragged in from the blocks panel and dropped into the editor. I don't think this should happen when a block is moved around the editor (that's what component:update is for...)

Reproduce

  1. https://jsfiddle.net/szLp8h4n/11/
  2. Move any of the text components around in the page.
  3. An alert will be displayed.

Great project btw. 👍

@artf
Copy link
Member

artf commented Feb 18, 2018

Thanks for the catch James, I'll fix it for the next release

@artf artf closed this as completed in 1fe03dd Mar 8, 2018
@lv-alex
Copy link

lv-alex commented Mar 14, 2018

hi,
When is the next release? Is it possible for us to fix it on our end before the release? We are seeing this issue now and our release goes out in 2 weeks.

thank you
ca

@artf
Copy link
Member

artf commented Mar 15, 2018

@lv-alex I planned to release for the end of this week

@lv-alex
Copy link

lv-alex commented Mar 19, 2018

thank you @artf . We will try it out

@lv-alex
Copy link

lv-alex commented Mar 21, 2018

It works. Thank you @artf

@japo32
Copy link

japo32 commented Sep 2, 2019

Is this anywhere in the new documentation? I can't seem to find any reference to component:add

@artf
Copy link
Member

artf commented Sep 4, 2019

@japo32 all available public events are documented here: https://grapesjs.com/docs/api/editor.html#available-events

@seifelhoseiny
Copy link

Any update on this issue? It still calls component:add event when I simply move a component around.

@lukjaki
Copy link

lukjaki commented Dec 30, 2022

It also triggers component:add when selecting different components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants