QUESTION: adding traits are not picked up by trait manager.
Question
Following example from docs .
Is there further configurtion to make new traitsa show for elements? The example using the input does not run, My id's are being picked up but not the additional attributes.
// try adding traits
editor.DomComponents.addType('ol', {
isComponent: el => el.tagName == 'OL',
model: {
defaults: {
traits: [
{
type: 'select', // Type of the trait
label: 'Type', // The label you will see in Settings
name: 'type', // The name of the attribute/property to use on component
options: [
{ id: '1', name: 'Numbers'},
{ id: 'a', name: 'Alphabetically lower'},
{ id: 'A', name: 'Alphabetically upper'},
{ id: 'i', name: 'Roman lower'},
{ id: 'I', name: 'Roman upper'},
]
}, {
type: 'number',
name: 'start',
}],
// As by default, traits are binded to attributes, so to define
// their initial value we can use attributes
attributes: { type: '1', start: 1 },
},
},
});
Answers (2)
I'm able to see your example properly and all the traits are working correctly. Are you able to create a reproducible demo?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2149
[QUESTIONS] Create checkbox(input) in define new trait
How to make a checkbox input type in define new trait (https://grapesjs.com/docs/modules/Traits.html#define-new-trait-type), I have made it...
Issue #3097
BUG: Custom traits not showing up
I am trying to make custom traits following the guidelines from Grapesjs Trait manager, and I have been through previous issues but the tra...
Issue #3130
[Question] Standard approach in slight restructuring the HTML toolbar & badge
Version: 0.15.10 This question is intended to validate if there is a proper way to extend the current https://github.com/artf/grapesjs/blob...
Issue #3524
[QUESTION]: Integrate select2 UI element into traits
I'm new to grapesJS ... Great tool.I have a few questions about traits. I followed this tutorial https://grapesjs.com/docs/modules/Traits.h...
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.