This repository was archived by the owner on Oct 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const IFRAME_TAG = /<iframe.+?src=['"](.+?)['"]/gi;
99const FRAMER_URLS = / \b ( (?: h t t p s ? \/ \/ ) ? (?: w w w \. ) ? (?: f r a m e r \. c l o u d | s h a r e \. f r a m e r j s \. c o m ) ( \/ [ A - Z a - z 0 - 9 \- \. _ ~ : \/ \? # \[ \] @ ! $ & ' \( \) \* \+ , ; \= ] * ) ? ) / gi;
1010const CODEPEN_URLS = / \b (?: \/ \/ ) ? (?: w w w \. ) ? c o d e p e n \. i o ( \/ [ A - Z a - z 0 - 9 \- \. _ ~ : \/ \? # \[ \] @ ! $ & ' \( \) \* \+ , ; \= ] * ) ? / gi;
1111const CODESANDBOX_URLS = / \b (?: \/ \/ ) ? (?: w w w \. ) ? c o d e s a n d b o x \. i o ( \/ [ A - Z a - z 0 - 9 \- \. _ ~ : \/ \? # \[ \] @ ! $ & ' \( \) \* \+ , ; \= ] * ) ? / gi;
12+ const SIMPLECAST_URLS = / \b (?: \/ \/ ) ? (?: w w w \. ) ? s i m p l e c a s t \. c o m ( \/ [ A - Z a - z 0 - 9 \- \. _ ~ : \/ \? # \[ \] @ ! $ & ' \( \) \* \+ , ; \= ] * ) ? / gi;
1213
1314type AddEmbedAttrs = {
1415 url : string ,
@@ -145,5 +146,14 @@ export const getEmbedsFromText = (text: string): Array<AddEmbedAttrs> => {
145146 } ) ;
146147 } ) ;
147148
149+ match ( SIMPLECAST_URLS , text ) . forEach ( path => {
150+ embeds . push ( {
151+ url : `https://embed.simplecast.com/${ path
152+ . replace ( '/s/' , '' )
153+ . replace ( '/' , '' ) } `,
154+ height : 200 ,
155+ } ) ;
156+ } ) ;
157+
148158 return embeds ;
149159} ;
Original file line number Diff line number Diff line change @@ -259,6 +259,38 @@ describe('sites', () => {
259259 ] ) ;
260260 } ) ;
261261 } ) ;
262+
263+ describe ( 'simplecast' , ( ) => {
264+ it ( 'should handle simplecast urls' , ( ) => {
265+ const text = 'https://simplecast.com/s/8fb96767' ;
266+ expect ( getEmbedsFromText ( text ) ) . toEqual ( [
267+ {
268+ height : 200 ,
269+ url : 'https://embed.simplecast.com/8fb96767' ,
270+ } ,
271+ ] ) ;
272+ } ) ;
273+
274+ it ( 'should handle simplecast urls with query params' , ( ) => {
275+ const text = 'https://simplecast.com/s/8fb96767?color=000000' ;
276+ expect ( getEmbedsFromText ( text ) ) . toEqual ( [
277+ {
278+ height : 200 ,
279+ url : 'https://embed.simplecast.com/8fb96767?color=000000' ,
280+ } ,
281+ ] ) ;
282+ } ) ;
283+
284+ it ( 'should handle embed urls' , ( ) => {
285+ const text = 'https://embed.simplecast.com/8fb96767' ;
286+ expect ( getEmbedsFromText ( text ) ) . toEqual ( [
287+ {
288+ height : 200 ,
289+ url : 'https://embed.simplecast.com/8fb96767' ,
290+ } ,
291+ ] ) ;
292+ } ) ;
293+ } ) ;
262294} ) ;
263295
264296describe ( 'complex text' , ( ) => {
You can’t perform that action at this time.
0 commit comments