Skip to content

Commit

Permalink
Built release for 0.3.16. For a full change log look at the notes wit…
Browse files Browse the repository at this point in the history
…hin the original/0.3.16 release.
  • Loading branch information
github-actions[bot] committed Mar 29, 2023
1 parent e08cc4b commit e95fe0d
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 8,771 deletions.
14 changes: 3 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
Changelog
=========

## v0.4.3
## v0.3.13

- Bug: Check model has mime type before checking value
- Bug: Check model has mime type before chaking value

## v0.4.2
## v0.3.12

- Bug: Don't trigger edit modal for non image files

## v0.4.1

- Bug: Fix WebP support for cropping and display

## v0.4.0

- Enhancement: Add filter to skip attachments during Smart Media processing

## v0.3.11

- Bug: AMP plugin compatibility with featured image modal selection
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"humanmade","repo":"smart-media","sha":"dc2675e7d79e8006d9d0b7028e8f857e1eaf5641","ref":"refs/tags/0.4.5","tagName":"0.4.5","branch":"gh-actions","tags":["0.4.5"],"updated_at":"2023-03-21T09:19:42.757Z"}
{"owner":"humanmade","repo":"smart-media","sha":"5264450aeefb1b4737febd74c0fab661d8c18f5f","ref":"refs/tags/0.3.16","tagName":"0.3.16","branch":"gh-actions","tags":["0.3.16"],"updated_at":"2023-03-29T16:45:48.713Z"}
1 change: 0 additions & 1 deletion inc/cropper/build/cropper.50f546b0.js

This file was deleted.

1 change: 1 addition & 0 deletions inc/cropper/build/cropper.fca5c494.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inc/cropper/media-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
<img src="{{ data.model.get( 'url' ) + ( data.model.get( 'url' ).indexOf( '?' ) >= 0 ? '&amp;' : '?' ) }}fit=0,120" width="{{ data.model.get( 'width' ) }}" height="{{ data.model.get( 'height' ) }}" alt="original" draggable="false" />
</button>
</li>
<# if ( data.model.get( 'mime' ).match( /image\/(jpe?g|png|gif|webp)/ ) ) { #>
<# if ( data.model.get( 'mime' ).match( /image\/(jpe?g|png|gif)/ ) ) { #>
<# _.each( data.model.get( 'sizes' ), function ( props, size ) { #>
<# if ( size && size !== 'full' && size !== 'full-orig' ) { #>
<li>
Expand Down
36 changes: 0 additions & 36 deletions inc/cropper/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ function rest_api_fields( WP_REST_Response $response ) : WP_REST_Response {
return $response;
}

// Check if we should skip this one.
if ( skip_attachment( $data['id'] ) ) {
return $response;
}

if ( isset( $data['source_url'] ) && $data['media_type'] === 'image' ) {
$data['original_url'] = $data['source_url'];
$data['source_url'] = tachyon_url( $data['source_url'] );
Expand Down Expand Up @@ -326,11 +321,6 @@ function attachment_js( $response, $attachment ) {
return $response;
}

// Check if we should skip.
if ( skip_attachment( $attachment->ID ) ) {
return $response;
}

$meta = wp_get_attachment_metadata( $attachment->ID );

if ( ! $meta ) {
Expand Down Expand Up @@ -414,24 +404,6 @@ function attachment_js( $response, $attachment ) {
return $response;
}

/**
* Check whether to skip an attachment for Smart Media processing.
*
* @uses filter hm.smart-media.skip-attachment
*
* @param integer $attachment_id The attachment ID to check.
* @return boolean
*/
function skip_attachment( int $attachment_id ) : bool {
/**
* Filters whether to skip a given attachment.
*
* @param bool $skip If true then the attachment should be skipped, default false.
* @param int $attachment_id The attachment ID to check.
*/
return (bool) apply_filters( 'hm.smart-media.skip-attachment', false, $attachment_id );
}

/**
* Updates attachments that aren't images but have thumbnails
* like PDFs to use Tachyon URLs.
Expand All @@ -445,10 +417,6 @@ function attachment_thumbs( $response, $attachment ) : array {
return $response;
}

if ( skip_attachment( $attachment->ID ) ) {
return $response;
}

// Handle attachment thumbnails.
$full_size_thumb = $response['sizes']['full']['url'] ?? false;

Expand Down Expand Up @@ -747,10 +715,6 @@ function filter_attachment_meta_data( $data, $attachment_id ) {
return $data;
}

if ( skip_attachment( $attachment_id ) ) {
return $data;
}

$data = massage_meta_data_for_orientation( $data );

// Full size image info.
Expand Down
8 changes: 8 additions & 0 deletions inc/cropper/src/cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ Media.view.MediaFrame.Select = MediaFrameSelect.extend( {
// Update the placeholder the featured image frame uses to set its
// default selection from.
if ( isFeaturedImage ) {
// Avoid updating attributes on any selected blocks.
if ( wp && wp.data ) {
const selectedBlock = wp.data.select( 'core/block-editor' )?.getSelectedBlock();
if ( selectedBlock ) {
wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
}
}

wp.media.view.settings.post.featuredImageId = single.get( 'id' );
}

Expand Down
2 changes: 1 addition & 1 deletion inc/cropper/src/views/image-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ImageEditView = Media.View.extend( {
views.push( new Media.view.Spinner() );
} else {
// Ensure this attachment is editable.
if ( this.model.get( 'editor' ) && this.model.get( 'mime' ).match( /image\/(gif|jpe?g|png|webp)/ ) ) {
if ( this.model.get( 'editor' ) && this.model.get( 'mime' ).match( /image\/(gif|jpe?g|png)/ ) ) {
views.push( new ImageEditSizes( {
controller: this.controller,
model: this.model,
Expand Down
3 changes: 0 additions & 3 deletions manifest.json

This file was deleted.

Loading

0 comments on commit e95fe0d

Please sign in to comment.