Skip to content

Commit

Permalink
Add x and instagram url support to media embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Aug 7, 2024
1 parent 70e3a04 commit 6cd9dc3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/ckeditor5-media-embed/src/mediaembedediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,17 @@ export default class MediaEmbedEditing extends Plugin {

{
name: 'instagram',
url: /^instagram\.com\/p\/(\w+)/
url: [
/^instagram\.com\/p\/(\w+)/,
/^instagram\.com\/reel\/(\w+)/
]
},
{
name: 'twitter',
url: /^twitter\.com/
url: [
/^twitter\.com/,
/^x\.com/
]
},
{
name: 'googleMaps',
Expand Down
12 changes: 10 additions & 2 deletions packages/ckeditor5-media-embed/tests/mediaembedediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,23 @@ describe( 'MediaEmbedEditing', () => {
testMediaUpcast( [
'https://www.instagram.com/p/foo',
'www.instagram.com/p/foo',
'instagram.com/p/foo'
'instagram.com/p/foo',

'https://www.instagram.com/reel/Foo/',
'www.instagram.com/reel/Foo/',
'instagram.com/reel/Foo/'
] );
} );

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

'https://www.x.com/foo/bar',
'www.x.com/foo/bar',
'x.com/foo/bar'
] );
} );

Expand Down

0 comments on commit 6cd9dc3

Please sign in to comment.