Issue #2456✓ SolvedOpened December 12, 2019by varadero2 reactions

How to apply traits to components used for GrapesJs initialization

Quick answerby artf2

currently there is a problem on storing custom types unless they are defined inside a plugin. Not a problem 😬, you just need to load custom types before the content and using plugins is the only wayI can't add all possible such elements as plugins https://jsfiddle.net/artur_arseniev/9tg0a36c/

Read full answer below ↓

Question

I am using This works but only for blocks which are added/drag-dropped to the editor manually after it is initialized. If we supply components when we call grapesjs.init({..., components: [..]}), the components defined in components do not have the traits. How can we apply traits to initially loaded components too, not only to these added later manually ?

Answers (3)

👍 Most helpfulartfDecember 14, 2019

currently there is a problem on storing custom types unless they are defined inside a plugin. Not a problem 😬, you just need to load custom types before the content and using plugins is the only wayI can't add all possible such elements as plugins https://jsfiddle.net/artur_arseniev/9tg0a36c/

varaderoDecember 12, 2019

This is how it can be reproduced:Go to https://jsfiddle.net/nwsy6mv1/3/Open blocks and place "1 Column" blockClick inside the column and go to "Settings"You will see the drop-down trait with label "Trait label"At this time the grapesjs components are saved in the local storage because it is configu...

pouyamiralayiDecember 12, 2019

Hi @varadero please define your custom type as a plugin. cheers!

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.