Adding traits to wrapper
Question
I found a way to add traits to wrapper via init function,
domComponents: {
wrapper: {
emovable: false,
copyable: false,
draggable: false,
traits: [...]
}
}
But I had to add other wrapper configs such as emovable, copyable, etc. Since wrapper is only a config element I hope this is the default behavior. However if there is a way to just add traits[] without other properties, how it could be done?
Also I did following.
DomComponents.getWrapper().get('traits').add({'name':'test', 'type': 'text', 'label':'Test'})
When I click on wrapper element, I get following error message.

Anyway I'm going to go with the config setting, the first one I described. If there is a better way of doing it, please give me some information.
Thanks.
Answers (3)
But I had to add other wrapper configs such as emovable, copyable, etc. Since wrapper is only a config element I hope this is the default behavior. However if there is a way to just add traits[] without other properties, how it could be done?
If you do it via init config, this is the way and you have to specify all other properties if you need them.
Also I did following. DomComponents.getWrapper().get('traits').add({'name':'test', 'type': 'text', 'label':'Test'}) When I click on wrapper element, I get following error message.
Just tried the same code on the demo and it worked as expected (try to update to the latest version)
I was using 0.14.5. It is working nicely with 0.14.15. Thanks for the tip and sorry to bother without testing it against latest version.
@sura2k How did you extracted the wrapper's trait values after they're set? /cc. @artf
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1374
Default Component Properties
Is there any way I can change the default properties of components? I want almost everything to be copyable: false, resizable: false, dragg...
Issue #1864
[QUESTION] Best way to listen to changes on the final HTML?
Hi, I just had a quick question because I could not figure out how to do it or did not find an issue related to it. I am just trying to cal...
Issue #958
Unable to create a popup by using bootbox or any other way.
Unable to create bootbox popup. Below is my code:- var blockManager = editor.BlockManager; blockManager.add('design', { label: 'Design', co...
Issue #1078
add custom date time picker for countdown
For countdown we would like to add our custom datetime picker not just the html one.We tried adding click event in its trait this way trait...
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.