<?php
return [
...
'toolbar' => [
...
'options' => [
...
'mediaEmbed' => [
'providers' => [
[
'name' => 'youtube',
'url' => [
'/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/',
'/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/',
'/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/',
'/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/'
],
'html' => '
<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: calc(56.2493% + 26px);">
<div><b>id</b>: ${match[1]}, <b>start</b>: ${match[2]}</div>
<iframe
src="https://www.youtube.com/embed/${match[1]}${match[2] ? `?start=${match[2]}` : ""}"
style="position: absolute; width: 100%; height: calc(100% - 26px); top: 26px; left: 0;"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen
/>
</div>'
]
],
// or
'extraProviders' => [
[
'name' => 'example',
'url' => '/^example\.com\/media\/(\w+)\/(.+)/',
'html' => '<p>first: ${match[1]}</p><p>second: ${match[2]}</p>'
]
]
],
]
],
];