conditional traits
Question
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?
Answers (2)
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #501
Add custom CSS rule
Hi! I would like to add a CSS rule that, for instance, changes appearance of a component based on some attribute. I.e. Is there a way of do...
Issue #1485
How to prevent styling html components?
Im trying to create some templates, which should not be editable and styleable. So that when i drag in my blocks then should stay as define...
Issue #467
Set the focus to some other element
I am opening a pop up on click o some element, but the focus is still on the element on which I click. I want to focus the pop up element....
Issue #604
trigger after removing component
Guys I need to trigger some action after removing editor's components. Is there any way to do so? Or have I to write my own trigger?
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.