Traits appear first time when draged custom component
Question
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)
Please create a live demo of this issue
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.
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.
Issue #1369
[BUG] Class of a block doesn't always show in the classes section
Hello everyone, I have added many custom blocks and gave the same css class to all the images in those blocks. Let's call it for now 'image...
Issue #1493
[QUESTION] render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
Issue #1296
Custom Rich Text Editor is not working
Hi @artf, I've just created a custom plugin of the RTE using different libraries like CKEditor 5, TinyMCE 4 or pell but all of them with th...
Issue #1468
[bug] modaltitle no effect
Hello, I can't translate asset manager title to french. Example : assetManager: { storageType: '', storeOnChange: true, storeAfterUpload: t...
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.