Issue #687💬 AnsweredOpened December 27, 2017by TWCM1 reactions

After update the component attributes using editor.on('component:add',function(){}); The blue box item is not correct.

Quick answerby artf1

@tommywulove ok I close this then @ryandeba As you already mentioned the toolbar is created when the component is initialized so, honestly, I don't see it as a bug and overall, your snippet should work well. BTW thanks for your willingness to help

Read full answer below ↓

Question

After update the component attributes using editor.on('component:add',function(){}); The blue box item(it mean the action icon) is not correct. The copy icon should not show. Javascript var hasClass = function(model, className){ return model.get('classes').where({name: className}).length; } var updateProperty = function (model) { model.set({ draggable: false, droppable: false, copyable: false, removable: false, selectable: false, editable: false }); if (hasClass(model,"editable")) { model.set('editable', true); } if (hasClass(model,"selectable")) { model.set('selectable', true); } if (hasClas...

Answers (3)

artfDecember 28, 2017

@tommywulove ok I close this then

@ryandeba As you already mentioned the toolbar is created when the component is initialized so, honestly, I don't see it as a bug and overall, your snippet should work well. BTW thanks for your willingness to help

ryandebaDecember 28, 2017

Hi @tommywulove, I believe the "blue box item" that you're referring to is the component toolbar. All of the toolbar buttons are created for each component as that component is initialized; changing a property (like copyable) does not automatically update the toolbar. You could probably force the t...

TWCMDecember 28, 2017

Hi @ryandeba , Thanks for your reply. I found that the component:add event is not suitable for my case, so i used component type to solve my problem. I updated the component type and added some new component type to control which action can be use in the element.

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.