Add Prezi embed support

Increase size of video embeds
This commit is contained in:
Tom Moor
2019-01-05 23:43:51 -08:00
parent accba7614c
commit 44e04c57a9
6 changed files with 46 additions and 12 deletions

View File

@ -14,13 +14,6 @@ export default class Loom extends React.Component<Props> {
render() {
const normalizedUrl = this.props.url.replace('share', 'embed');
return (
<Frame
width="420px"
height="235px"
src={normalizedUrl}
title="Loom Embed"
/>
);
return <Frame src={normalizedUrl} title="Loom Embed" />;
}
}

19
app/embeds/Prezi.js Normal file
View File

@ -0,0 +1,19 @@
// @flow
import * as React from 'react';
import Frame from './components/Frame';
const URL_REGEX = new RegExp('^https://prezi.com/view/(.*)$');
type Props = {
url: string,
};
export default class Prezi extends React.Component<Props> {
static ENABLED = [URL_REGEX];
render() {
const url = this.props.url.replace(/\/embed$/, '');
return <Frame src={`${url}/embed`} title="Prezi Embed" border />;
}
}

24
app/embeds/Prezi.test.js Normal file
View File

@ -0,0 +1,24 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import embeds from '.';
const { Prezi } = embeds;
describe('Prezi', () => {
const match = Prezi.ENABLED[0];
test('to be enabled on share link', () => {
expect(
'https://prezi.com/view/39mn8Rn1ZkoeEKQCgk5C'.match(match)
).toBeTruthy();
});
test('to be enabled on embed link', () => {
expect(
'https://prezi.com/view/39mn8Rn1ZkoeEKQCgk5C/embed'.match(match)
).toBeTruthy();
});
test('to not be enabled elsewhere', () => {
expect('https://prezi.com'.match(match)).toBe(null);
expect('https://prezi.com/pricing'.match(match)).toBe(null);
});
});

View File

@ -18,8 +18,6 @@ export default class Vimeo extends React.Component<Props> {
return (
<Frame
width="420px"
height="235px"
src={`http://player.vimeo.com/video/${videoId}?byline=0`}
title={`Vimeo Embed (${videoId})`}
/>

View File

@ -18,8 +18,6 @@ export default class YouTube extends React.Component<Props> {
return (
<Frame
width="420px"
height="235px"
src={`https://www.youtube.com/embed/${videoId}?modestbranding=1`}
title={`YouTube (${videoId})`}
/>

View File

@ -11,6 +11,7 @@ import Lucidchart from './Lucidchart';
import Marvel from './Marvel';
import ModeAnalytics from './ModeAnalytics';
import Numeracy from './Numeracy';
import Prezi from './Prezi';
import RealtimeBoard from './RealtimeBoard';
import Spotify from './Spotify';
import Trello from './Trello';
@ -31,6 +32,7 @@ export default {
Marvel,
ModeAnalytics,
Numeracy,
Prezi,
RealtimeBoard,
Spotify,
Trello,