diff --git a/packages/block-library/src/file/index.php b/packages/block-library/src/file/index.php index 83c6dab20157d..042ea89970736 100644 --- a/packages/block-library/src/file/index.php +++ b/packages/block-library/src/file/index.php @@ -59,7 +59,8 @@ static function ( $matches ) { $processor->next_tag(); $processor->set_attribute( 'data-wp-interactive', '' ); $processor->next_tag( 'object' ); - $processor->set_attribute( 'data-wp-style--display', 'selectors.core.file.hasPdfPreview' ); + $processor->set_attribute( 'data-wp-bind--hidden', '!selectors.core.file.hasPdfPreview' ); + $processor->set_attribute( 'hidden', true ); return $processor->get_updated_html(); } diff --git a/packages/block-library/src/file/style.scss b/packages/block-library/src/file/style.scss index 11d0a8a46f321..31c76ff2641fb 100644 --- a/packages/block-library/src/file/style.scss +++ b/packages/block-library/src/file/style.scss @@ -29,12 +29,6 @@ margin-bottom: 1em; } -@media (max-width: 768px) { - .wp-block-file__embed { - display: none; - } -} - //This needs a low specificity so it won't override the rules from the button element if defined in theme.json. :where(.wp-block-file__button) { border-radius: 2em; diff --git a/packages/block-library/src/file/view.js b/packages/block-library/src/file/view.js index 51c726d0cbe5e..9d09ca2b7f434 100644 --- a/packages/block-library/src/file/view.js +++ b/packages/block-library/src/file/view.js @@ -5,13 +5,13 @@ import { store } from '@wordpress/interactivity'; /** * Internal dependencies */ -import { browserSupportsPdfs } from './utils'; +import { browserSupportsPdfs as hasPdfPreview } from './utils'; store( { selectors: { core: { file: { - hasPdfPreview: browserSupportsPdfs() ? 'inherit' : 'none', + hasPdfPreview, }, }, },