Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmikita committed Sep 12, 2019
2 parents abacfcb + 18d9774 commit 2cd4bd9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
29 changes: 14 additions & 15 deletions assets/src/scripts/views/media-grid/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,29 @@ import { filterSelection, isImage } from '../../utils/functions.js';
/* global wp, ew */

if ( wp.media && 'function' === typeof wp.media.view.Attachment.Library ) {
wp.media.view.Attachment.Library = class extends wp.media.view.Attachment.Library {
const Library = wp.media.view.Attachment.Library;
wp.media.view.Attachment.Library = Library.extend( {
initialize() {
super.initialize();
Library.prototype.initialize.apply( this, arguments );

this.listenTo( this.model, 'ewBulkAction:start', this.showLoader );
this.listenTo( this.model, 'ewBulkAction:done', this.render );

this.controller.on( 'selection:toggle watermark:activate processing:activate', this.disable, this );
this.controller.on( 'watermark:deactivate processing:deactivate', this.enable, this );
}
},

render() {
super.render();
Library.prototype.render.apply( this, arguments );

this.$el.append( $( '<span></span>' ).addClass( 'spinner' ) );
}

toggleSelection( options ) {
const { method } = options;
},

toggleSelection( { method } ) {
if ( ! this.controller.isModeActive( 'watermark' ) ||
( ( isImage( this.model ) && ! this.model.get( 'usedAsWatermark' ) ) || 'between' === method ) ) {
// In watermark mode only select images.
super.toggleSelection( options );
Library.prototype.toggleSelection.apply( this, arguments );
}

if ( this.controller.isModeActive( 'watermark' ) ) {
Expand All @@ -46,11 +45,11 @@ if ( wp.media && 'function' === typeof wp.media.view.Attachment.Library ) {
filterSelection( this.options.selection );
}
}
}
},

showLoader() {
this.$el.find( '.spinner' ).css( { visibility: 'visible' } );
}
},

disable() {
if ( ! this.controller.isModeActive( 'watermark' ) && ! this.controller.isModeActive( 'processing' ) ) {
Expand Down Expand Up @@ -81,21 +80,21 @@ if ( wp.media && 'function' === typeof wp.media.view.Attachment.Library ) {

this.$el.addClass( 'disabled' ).append( badge );
this.hasBadge = true;
}
},

enable() {
if ( ! this.controller.isModeActive( 'watermark' ) && ! this.controller.isModeActive( 'processing' ) ) {
this.$el.removeClass( 'disabled' ).find( '.badge' ).remove();
this.hasBadge = false;
}
}
},

wasSelected() {
const selection = this.controller.state().get( 'originalSelection' );

if ( selection ) {
return !! selection.get( this.model.cid );
}
}
};
},
} );
}
2 changes: 1 addition & 1 deletion easy-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author URI: https://bracketspace.com/
* Text Domain: easy-watermark
* Domain Path: /languages
* Version: 1.0.1
* Version: 1.0.2
* License: GPLv2 or later
*
* @package easy-watermark
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: watermark, image, picture, photo, media, gallery, signature, transparent,
Requires at least: 3.8
Requires PHP: 5.6
Tested up to: 5.2
Stable tag: 1.0.1
Stable tag: 1.0.2
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: easy-watermark
Expand Down Expand Up @@ -118,6 +118,9 @@ All available placeholders are listed in a box titled 'Placeholders' displayed w

== Changelog ==

= 1.0.2 =
* [Fixed] Media library not working with ACF plugin enabled

= 1.0.1 =
* [Fixed] Freemius screen displayed incorrectly after activation
* [Fixed] Permission settings now actualy works
Expand Down

0 comments on commit 2cd4bd9

Please sign in to comment.