Issue #3574Opened June 28, 2021by alpha2k-io0 reactions

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)

artfJuly 21, 20210 reactions

I'm able to see your example properly and all the traits are working correctly. Are you able to create a reproducible demo?

no-response[bot]July 31, 20210 reactions

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.

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.