Skip to content

Commit

Permalink
Restore captions for image and embed (#7749)
Browse files Browse the repository at this point in the history
This PR is a followup to #7624.

It adds back the caption styles for images and embeds. This is because the majority of existing themes won't have styles to accommodate the new `figcaption` markup, and are likely to be styling the WP Captions instead. For those themes, if the caption styles live in the `theme.scss` file, the captions will appear unstyled or broken.

Some time in the future, this can possibly be revisited and shuffled around.
  • Loading branch information
jasmussen authored and aduth committed Jul 6, 2018
1 parent e408fa7 commit 6edaf68
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion core-blocks/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import apiRequest from '@wordpress/api-request';
*/
import './style.scss';
import './editor.scss';
import './theme.scss';

// These embeds do not work in sandboxes
const HOSTS_NO_PREVIEWS = [ 'facebook.com' ];
Expand Down
9 changes: 9 additions & 0 deletions core-blocks/embed/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
max-width: $content-width / 2;
width: 100%;
}

.wp-block-embed {
// Supply caption styles to images, even if the theme hasn't opted in.
// Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes,
// so we supply the styles so as to not appear broken or unstyled in those.
figcaption {
@include caption-style();
}
}
3 changes: 0 additions & 3 deletions core-blocks/embed/theme.scss

This file was deleted.

1 change: 0 additions & 1 deletion core-blocks/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { createBlobURL } from '@wordpress/blob';
* Internal dependencies
*/
import './style.scss';
import './theme.scss';
import edit from './edit';

export const name = 'core/image';
Expand Down
7 changes: 7 additions & 0 deletions core-blocks/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
max-width: none;
}
}

// Supply caption styles to images, even if the theme hasn't opted in.
// Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes,
// so we supply the styles so as to not appear broken or unstyled in those.
figcaption {
@include caption-style();
}
}
5 changes: 0 additions & 5 deletions core-blocks/image/theme.scss

This file was deleted.

0 comments on commit 6edaf68

Please sign in to comment.