Issue #2486✓ SolvedOpened January 2, 2020by andrewryan190612 reactions

How do I add a trait to all existing component types?

Quick answerby pouyamiralayi12

@andrewryan1906 for pulling the default traits: so your traits definition would be like below: cheers!

Read full answer below ↓

Question

I want to go through all existing component types and add a trait to the model-> defaults and can't figure out how to do this. According to the documentation, I should be able to (in my plugin): But this overrides the traits array, which removes the existing traits, which isn't what I want. My next step was to try to get the old traits and concat them with my new ones - but I can't figure out how to pull the default traits for each type in order to do this. How can I append a trait to all (or some) component types?

Answers (1)

👍 Most helpfulpouyamiralayiJanuary 3, 2020

@andrewryan1906 for pulling the default traits: so your traits definition would be like below: 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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.