Skip to content

Commit

Permalink
Allow youtube shorts links in media embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Sep 16, 2024
1 parent eb2c92d commit bba1f7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ckeditor5-media-embed/src/mediaembedediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default class MediaEmbedEditing extends Plugin {
name: 'youtube',
url: [
/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,
/^(?:m\.)?youtube\.com\/shorts\/([\w-]+)(?:\?t=(\d+))?/,
/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,
/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,
/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/
Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-media-embed/tests/mediaembedediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ describe( 'MediaEmbedEditing', () => {

it( 'upcasts the URL (youtube)', () => {
testMediaUpcast( [
'https://www.youtube.com/shorts/foo',
'www.youtube.com/shorts/foo',
'youtube.com/shorts/foo',

'https://www.youtube.com/watch?v=foo',
'www.youtube.com/watch?v=foo',
'youtube.com/watch?v=foo',
Expand Down

0 comments on commit bba1f7f

Please sign in to comment.