Skip to content

Commit

Permalink
Revert CSS changes to show/hide embedded pdf (#55667)
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz authored Oct 27, 2023
1 parent 6ed6a1a commit f5ab705
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/file/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
6 changes: 0 additions & 6 deletions packages/block-library/src/file/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/file/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down

0 comments on commit f5ab705

Please sign in to comment.