From d677a7ac9a4106ea6d61bd5a65ef9669636710a2 Mon Sep 17 00:00:00 2001 From: jasmussen Date: Fri, 6 Jul 2018 17:14:10 +0200 Subject: [PATCH] Restore captions for image and embed 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. --- core-blocks/embed/index.js | 1 - core-blocks/embed/style.scss | 9 +++++++++ core-blocks/embed/theme.scss | 3 --- core-blocks/image/index.js | 1 - core-blocks/image/style.scss | 7 +++++++ core-blocks/image/theme.scss | 5 ----- 6 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 core-blocks/embed/theme.scss delete mode 100644 core-blocks/image/theme.scss diff --git a/core-blocks/embed/index.js b/core-blocks/embed/index.js index 18a5e34638628..1332db7164099 100644 --- a/core-blocks/embed/index.js +++ b/core-blocks/embed/index.js @@ -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' ]; diff --git a/core-blocks/embed/style.scss b/core-blocks/embed/style.scss index 68b9aff572570..d6a8b0c81bcc5 100644 --- a/core-blocks/embed/style.scss +++ b/core-blocks/embed/style.scss @@ -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(); + } +} diff --git a/core-blocks/embed/theme.scss b/core-blocks/embed/theme.scss deleted file mode 100644 index 63e9f70ad7511..0000000000000 --- a/core-blocks/embed/theme.scss +++ /dev/null @@ -1,3 +0,0 @@ -.wp-block-embed figcaption { - @include caption-style(); -} diff --git a/core-blocks/image/index.js b/core-blocks/image/index.js index d21eedd63de78..361aee8b548e2 100644 --- a/core-blocks/image/index.js +++ b/core-blocks/image/index.js @@ -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'; diff --git a/core-blocks/image/style.scss b/core-blocks/image/style.scss index fd29c1e086b0b..9797196434499 100644 --- a/core-blocks/image/style.scss +++ b/core-blocks/image/style.scss @@ -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(); + } } diff --git a/core-blocks/image/theme.scss b/core-blocks/image/theme.scss deleted file mode 100644 index b4a202bb326eb..0000000000000 --- a/core-blocks/image/theme.scss +++ /dev/null @@ -1,5 +0,0 @@ -.wp-block-image { - figcaption { - @include caption-style(); - } -} \ No newline at end of file