Skip to content

Commit

Permalink
Update the embed block to show no preview for smugmug (#12961)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentswisher authored and youknowriad committed Mar 6, 2019
1 parent 00ff3b7 commit 2b0c4c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/embed/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// These embeds do not work in sandboxes due to the iframe's security restrictions.
export const HOSTS_NO_PREVIEWS = [ 'facebook.com' ];
export const HOSTS_NO_PREVIEWS = [ 'facebook.com', 'smugmug.com' ];

export const ASPECT_RATIOS = [
// Common video resolutions.
Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/embed/embed-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ const EmbedPreview = ( props ) => {
const { scripts } = preview;

const html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;
const parsedUrl = parse( url );
const cannotPreview = includes( HOSTS_NO_PREVIEWS, parsedUrl.host.replace( /^www\./, '' ) );
const parsedHost = parse( url ).host.split( '.' );
const parsedHostBaseUrl = parsedHost.splice( parsedHost.length - 2, parsedHost.length - 1 ).join( '.' );
const cannotPreview = includes( HOSTS_NO_PREVIEWS, parsedHostBaseUrl );
// translators: %s: host providing embed content e.g: www.youtube.com
const iframeTitle = sprintf( __( 'Embedded content from %s' ), parsedUrl.host );
const iframeTitle = sprintf( __( 'Embedded content from %s' ), parsedHostBaseUrl );
const sandboxClassnames = classnames( type, className, 'wp-block-embed__wrapper' );

const embedWrapper = 'wp-embed' === type ? (
Expand Down

0 comments on commit 2b0c4c8

Please sign in to comment.