From 6cd9dc30089116f7481ce52b067245eb2e8678bf Mon Sep 17 00:00:00 2001 From: Mateusz Baginski Date: Wed, 7 Aug 2024 09:37:25 +0200 Subject: [PATCH] Add x and instagram url support to media embed --- .../ckeditor5-media-embed/src/mediaembedediting.ts | 10 ++++++++-- .../ckeditor5-media-embed/tests/mediaembedediting.js | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/ckeditor5-media-embed/src/mediaembedediting.ts b/packages/ckeditor5-media-embed/src/mediaembedediting.ts index 5698048930b..ea22af6ebcf 100644 --- a/packages/ckeditor5-media-embed/src/mediaembedediting.ts +++ b/packages/ckeditor5-media-embed/src/mediaembedediting.ts @@ -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', diff --git a/packages/ckeditor5-media-embed/tests/mediaembedediting.js b/packages/ckeditor5-media-embed/tests/mediaembedediting.js index b3b50be2ac4..02aec4d5ee8 100644 --- a/packages/ckeditor5-media-embed/tests/mediaembedediting.js +++ b/packages/ckeditor5-media-embed/tests/mediaembedediting.js @@ -301,7 +301,11 @@ 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/' ] ); } ); @@ -309,7 +313,11 @@ describe( 'MediaEmbedEditing', () => { 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' ] ); } );