Issue #2081💬 AnsweredOpened June 17, 2019by Amir28280 reactions

Changing Traits Dynamically

快速解答by afdallah

If what you want is changing the default player to be youtube player, simply change the provider property under your block definition.

Read full answer below ↓

Question

Is it possible to change traits default selection?? For example when dragging a video, I wish that the default trait selection will be youtube instead of HTML5 source.

Answers (3)

afdallahJune 19, 2019

If what you want is changing the default player to be youtube player, simply change the provider property under your block definition.

const bm = editor.BlockManager

bm.add('your-video-block-name', {
  label: 'Video',
  attributes: { class: 'fa fa-play-circle' },
  content: {
    type: 'video',
    provider: 'yt', // this line will do the trick
    videoId: 'hiBXAjK3dPU', // you can even set a default video, put youtube video id here
    src: '', 
  }
})
Amir2828June 25, 2019

Thanks a lot, that did the trick!

lock[bot]June 24, 2020

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.