grapesjs
grapesjs copied to clipboard
How to: find some component at canvas, on event "component:add"
Hi everyone, let say i've added block
Thanks for your attention. I just read the doc. And ended up with this solution:
editor.on('component:add', function(currentComp) {
if (currentComp.attributes.tagName == "form"){
var modelList = (domComps.getComponents()).models;
var presentForms = modelList.filter(function(component) {
return component.attributes.tagName == "form";
});
if (presentForms.length > 1){
//console.log("canvas have > 2 forms");
implodeComponents(currentComp, presentForms);
}
}
});
@konstantin55000 hi ,bro ,domComps.getComponents() is getting all models,i just want to get button.how can i do it?thanks
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.