grapesjs
grapesjs copied to clipboard
conditional traits
is there way to have conditional traits? if is current component is youtube video then have some traits and if video is non-youtube then shows other traits?
Hi @krunal039,
The video component seems to do this already to some extent - see here. If you want to customize the traits further, you could probably do something like this (untested code, but copied and modified from something similar that I've done):
var videoType = editor.DomComponents.getType('video');
editor.DomComponents.addType('video', {
model: videoType.model.extend({
getYoutubeTraits() {
return []; // replace this empty array with your desired traits
}
}),
view: videoType.view
});
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.