Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit bc63b8b

Browse files
committed
Merge branch 'alpha' of github.com:withspectrum/spectrum into 2.5.5
2 parents 47dd328 + 2f76af1 commit bc63b8b

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/components/rich-text-editor/Embed.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
YOUTUBE_URLS,
1212
VIMEO_URLS,
1313
CODEPEN_URLS,
14+
CODESANDBOX_URLS,
1415
} from '../../helpers/regexps';
1516
import addProtocolToString from 'shared/normalize-url';
1617

@@ -82,6 +83,14 @@ export const parseEmbedUrl = incomingUrl => {
8283
};
8384
}
8485

86+
const isCodeSandboxUrl = url.match(CODESANDBOX_URLS);
87+
if (isCodeSandboxUrl) {
88+
return {
89+
url,
90+
height: 500,
91+
};
92+
}
93+
8594
if (!isURL(url)) return null;
8695

8796
return {

src/helpers/regexps.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const URLS = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4
33
// eslint-disable-next-line
44
export const FIGMA_URLS = /https:\/\/([w.-]+.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/gi;
55
// eslint-disable-next-line
6-
export const YOUTUBE_URLS = /(?:[?&]v=|\/embed\/|\/1\/|\/v\/|https:\/\/(?:www\.)?youtu\.be\/)([^&\n?#]+)/gi;
6+
export const YOUTUBE_URLS = /http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?/gi;
77
// eslint-disable-next-line
88
export const VIMEO_URLS = /\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/gi;
99
// eslint-disable-next-line
@@ -13,4 +13,6 @@ export const FRAMER_URLS = /(https?:\/\/(.+?\.)?framer\.cloud(\/[A-Za-z0-9\-\._~
1313
// eslint-disable-next-line
1414
export const CODEPEN_URLS = /(https?:\/\/)?(.+?\.)?codepen\.io(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?/gi;
1515
// eslint-disable-next-line
16+
export const CODESANDBOX_URLS = /(https?:\/\/)?(.+?\.)?codesandbox\.io(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?/gi;
17+
// eslint-disable-next-line
1618
export const ENDS_IN_WHITESPACE = /(\s|\n)$/;

src/views/explore/collections.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const collections = [
55
communities: [
66
'spectrum',
77
'zeit',
8+
'codesandbox',
89
'codepen',
910
'next-js',
1011
'figma',
@@ -77,6 +78,7 @@ export const collections = [
7778
'react',
7879
'next-js',
7980
'node',
81+
'codesandbox',
8082
'vue-js',
8183
'angular',
8284
'ember-js',

0 commit comments

Comments
 (0)