[BUG]: "component:add" event triggers when components are moved
Question
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
- https://jsfiddle.net/szLp8h4n/11/
- Move any of the text components around in the page.
- An alert will be displayed.
Great project btw. 👍
Answers (3)
@japo32 all available public events are documented here: https://grapesjs.com/docs/api/editor.html#available-events
Any update on this issue? It still calls component:add event when I simply move a component around.
It works. Thank you @artf
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3235
BUG: "component:update" does not trigger when components are moved
Taken from https://github.com/artf/grapesjs/blob/dev/src/editor/index.js#L33 component:update - Triggered when a component is updated (move...
Issue #581
Reading component related events
The Editor API wiki lists a set of component-related events that can be listened to (e.g. component:add, component:update). There is howeve...
Issue #792
Script property using function don't work with blocks
In Components & JS docs there's this example: This works perfectly. But I couldn't use a function instead of a string in script, as is said...
Issue #1113
[QUESTIONS] New trait type is not working with rendered components?
Hello, thanks for the great framework. I'm trying to apply this to my project. I want to add a new trait for existing LINK '<a>' component....
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.