BUG: Custom traits not showing up
Question
I am trying to make custom traits following the guidelines from Grapesjs Trait manager, and I have been through previous issues but the traits don't show up.
Expected result: custom traits like the ones below to show up. Actual result: default traits like id and title show up.
Currently, I'm using the trait manager website example code to test as shown below.
editor.DomComponents.addType('count', {
model: {
defaults: {
traits: [
// Strings are automatically converted to text types
'name', // Same as: { type: 'text', name: 'name' }
'placeholder',
{
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: 'text', name: 'Text'},
{ id: 'email', name: 'Email'},
{ id: 'password', name: 'Password'},
{ id: 'number', name: 'Number'},
]
}, {
type: 'checkbox',
name: 'required',
}],
// As by default, traits are binded to attributes, so to define
// their initial value we can use attributes
attributes: { type: 'text', required: true },
},
},
});
editor.BlockManager.add( 'count',
{
label: 'count',
category: 'Extra',
content: '<div id="customdiv"></div>',
attributes: {class:'fa fa-clock-o'},
});
Thank you for your help in advance. Please let me know if I need to provide more information.
Answers (2)
Hi,
If you didn't find answer here, you can contact with Devfuture Team: https://devfuture.pro/contact/
We specialise on GrapesJS.
Follow the issue template please and provide a live demo of the bug
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3574
QUESTION: adding traits are not picked up by trait manager.
Following example from docs . Is there further configurtion to make new traitsa show for elements? The example using the input does not run...
Issue #3068
FEAT: Trait Manager - Traits grouping feature like style manager
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #1609
Grapesjs, How to extract html/css code in view code into console log?
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #5549
BUG: mj-preview is not editable
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Safari 17Reproducible demo link https://grap...
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.