Issue #1696Opened December 31, 2018by muhamdgomaa280 reactions

Traits appear first time when draged custom component

Question

Code SnippetTEXT
Hi artf , i have created custom component and add traits for it , when dragging this component to editor and select it the setting  traits work correctly .
the proplem is when draged the same component behind the old component  to editor and select setting traits the default traits will appear ( id , title)  only , this is code that i implemented
for create component : 


        this.editor.BlockManager.add('customtext',{
            id: 'texttool',
            label: 'Text Tool',
            content:{
                components: [
                    {
                        tagName: 'texttool',
                        type:'texttool',
                        editable:true,
                        content:'// some html  '
    },
        ]
       },}

for adding traits for this comonent:


        this.domComps.addType('texttool', {
            model: dModel.extend({
            init(){
           this.listenTo(this, 'change:type', this.doStuff);
             },
            doStuff(){
               // do some tasks
               },
           defaults: Object.assign({}, dModel.prototype.defaults, {
                    traits: [
                        {
                            type: 'select',
                            label: 'data objects',
                            name: 'type',
                            options: this.contentobjectlist,
                            changeProp:1,
                        },
                    ],
                }),
            }, {
                isComponent: function(el) {
                    if(el.tagName == 'texttool'){
                        return {type: 'texttool'};
                    }
                },
            }),
           view: dView,
        });

Answers (3)

artfJanuary 4, 20190 reactions

Please create a live demo of this issue

no-response[bot]January 14, 20190 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.

lock[bot]April 15, 20200 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.