grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Changing Traits Dynamically

Open Amir2828 opened this issue 7 years ago • 3 comments

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.

Amir2828 avatar Jun 17 '19 10:06 Amir2828

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: '', 
  }
})

afdallah avatar Jun 19 '19 15:06 afdallah

Thanks a lot, that did the trick!

Amir2828 avatar Jun 25 '19 07:06 Amir2828

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.

lock[bot] avatar Jun 24 '20 19:06 lock[bot]