Issue #603Opened December 4, 2017by krunal0391 reactions

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)

ryandebaDecember 4, 20171 reactions

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
});
lock[bot]September 18, 20190 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.