Version Description
Download this release
Release Info
Developer | webbistro |
Plugin | Enhanced Media Library |
Version | 2.8.6 |
Comparing to | |
See all releases |
Code changes from version 2.8.5 to 2.8.6
- css/eml-admin-media-rtl.css +4 -2
- css/eml-admin-media.css +4 -2
- enhanced-media-library.php +44 -30
- js/eml-media-grid.js +94 -48
- js/eml-media-views.js +36 -28
- js/eml-media.js +211 -0
- readme.txt +12 -2
css/eml-admin-media-rtl.css
CHANGED
@@ -227,15 +227,17 @@ body.upload-php.eml-grid #wpbody-content > #screen-meta {
|
|
227 |
.media-frame.mode-eml-grid .attachments-browser .uploader-inline {
|
228 |
top: 0;
|
229 |
}
|
|
|
230 |
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
231 |
-
padding: 8px;
|
232 |
-
|
233 |
-webkit-transition: all 0.2s;
|
234 |
-moz-transition: all 0.2s;
|
235 |
-o-transition: all 0.2s;
|
236 |
-ms-transition: all 0.2s;
|
237 |
transition: all 0.2s;
|
238 |
}
|
|
|
|
|
|
|
239 |
.media-frame.mode-eml-grid .delete-attachment,
|
240 |
.media-frame.mode-eml-grid .trash-attachment,
|
241 |
.media-frame.mode-eml-grid .untrash-attachment {
|
227 |
.media-frame.mode-eml-grid .attachments-browser .uploader-inline {
|
228 |
top: 0;
|
229 |
}
|
230 |
+
.media-frame.mode-eml-grid .attachments-browser .attachments-wrapper,
|
231 |
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
|
|
|
|
232 |
-webkit-transition: all 0.2s;
|
233 |
-moz-transition: all 0.2s;
|
234 |
-o-transition: all 0.2s;
|
235 |
-ms-transition: all 0.2s;
|
236 |
transition: all 0.2s;
|
237 |
}
|
238 |
+
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
239 |
+
padding: 8px;
|
240 |
+
}
|
241 |
.media-frame.mode-eml-grid .delete-attachment,
|
242 |
.media-frame.mode-eml-grid .trash-attachment,
|
243 |
.media-frame.mode-eml-grid .untrash-attachment {
|
css/eml-admin-media.css
CHANGED
@@ -227,15 +227,17 @@ body.upload-php.eml-grid #wpbody-content > #screen-meta {
|
|
227 |
.media-frame.mode-eml-grid .attachments-browser .uploader-inline {
|
228 |
top: 0;
|
229 |
}
|
|
|
230 |
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
231 |
-
padding: 8px;
|
232 |
-
|
233 |
-webkit-transition: all 0.2s;
|
234 |
-moz-transition: all 0.2s;
|
235 |
-o-transition: all 0.2s;
|
236 |
-ms-transition: all 0.2s;
|
237 |
transition: all 0.2s;
|
238 |
}
|
|
|
|
|
|
|
239 |
.media-frame.mode-eml-grid .delete-attachment,
|
240 |
.media-frame.mode-eml-grid .trash-attachment,
|
241 |
.media-frame.mode-eml-grid .untrash-attachment {
|
227 |
.media-frame.mode-eml-grid .attachments-browser .uploader-inline {
|
228 |
top: 0;
|
229 |
}
|
230 |
+
.media-frame.mode-eml-grid .attachments-browser .attachments-wrapper,
|
231 |
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
|
|
|
|
232 |
-webkit-transition: all 0.2s;
|
233 |
-moz-transition: all 0.2s;
|
234 |
-o-transition: all 0.2s;
|
235 |
-ms-transition: all 0.2s;
|
236 |
transition: all 0.2s;
|
237 |
}
|
238 |
+
.media-frame.mode-eml-grid .attachments-browser .attachments {
|
239 |
+
padding: 8px;
|
240 |
+
}
|
241 |
.media-frame.mode-eml-grid .delete-attachment,
|
242 |
.media-frame.mode-eml-grid .trash-attachment,
|
243 |
.media-frame.mode-eml-grid .untrash-attachment {
|
enhanced-media-library.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Enhanced Media Library
|
4 |
Plugin URI: https://wpUXsolutions.com/plugins/enhanced-media-library
|
5 |
Description: This plugin will be handy for those who need to manage a lot of media files.
|
6 |
-
Version: 2.8.
|
7 |
Author: wpUXsolutions
|
8 |
Author URI: http://wpUXsolutions.com
|
9 |
Text Domain: enhanced-media-library
|
@@ -26,7 +26,7 @@ global $wp_version,
|
|
26 |
|
27 |
|
28 |
|
29 |
-
if ( ! defined('EML_VERSION') ) define( 'EML_VERSION', '2.8.
|
30 |
if ( ! defined('EML_PRO') ) define( 'EML_PRO', false );
|
31 |
|
32 |
|
@@ -380,26 +380,6 @@ if ( ! function_exists( 'wpuxss_eml_admin_enqueue_scripts' ) ) {
|
|
380 |
if ( isset( $current_screen ) && 'upload' === $current_screen->base && 'grid' === $media_library_mode ) {
|
381 |
|
382 |
wp_dequeue_script( 'media' );
|
383 |
-
wp_enqueue_script(
|
384 |
-
'wpuxss-eml-media-grid-script',
|
385 |
-
$wpuxss_eml_dir . 'js/eml-media-grid.js',
|
386 |
-
array( 'media-grid', 'wpuxss-eml-media-models-script', 'wpuxss-eml-media-views-script' ),
|
387 |
-
EML_VERSION,
|
388 |
-
true
|
389 |
-
);
|
390 |
-
|
391 |
-
$media_grid_l10n = array(
|
392 |
-
'grid_show_caption' => (int) $wpuxss_eml_lib_options['grid_show_caption'],
|
393 |
-
'grid_caption_type' => isset( $wpuxss_eml_lib_options['grid_caption_type'] ) ? sanitize_key( $wpuxss_eml_lib_options['grid_caption_type'] ) : 'title',
|
394 |
-
'more_details' => __( 'More Details', 'enhanced-media-library' ),
|
395 |
-
'less_details' => __( 'Less Details', 'enhanced-media-library' )
|
396 |
-
);
|
397 |
-
|
398 |
-
wp_localize_script(
|
399 |
-
'wpuxss-eml-media-grid-script',
|
400 |
-
'wpuxss_eml_media_grid_l10n',
|
401 |
-
$media_grid_l10n
|
402 |
-
);
|
403 |
}
|
404 |
}
|
405 |
}
|
@@ -521,14 +501,14 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
|
|
521 |
);
|
522 |
|
523 |
|
524 |
-
// TODO:
|
525 |
-
//
|
526 |
-
//
|
527 |
-
//
|
528 |
-
//
|
529 |
-
//
|
530 |
-
//
|
531 |
-
//
|
532 |
|
533 |
|
534 |
$media_models_l10n = array(
|
@@ -613,6 +593,40 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
|
|
613 |
$enhanced_medialist_l10n
|
614 |
);
|
615 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
}
|
617 |
}
|
618 |
|
3 |
Plugin Name: Enhanced Media Library
|
4 |
Plugin URI: https://wpUXsolutions.com/plugins/enhanced-media-library
|
5 |
Description: This plugin will be handy for those who need to manage a lot of media files.
|
6 |
+
Version: 2.8.6
|
7 |
Author: wpUXsolutions
|
8 |
Author URI: http://wpUXsolutions.com
|
9 |
Text Domain: enhanced-media-library
|
26 |
|
27 |
|
28 |
|
29 |
+
if ( ! defined('EML_VERSION') ) define( 'EML_VERSION', '2.8.6' );
|
30 |
if ( ! defined('EML_PRO') ) define( 'EML_PRO', false );
|
31 |
|
32 |
|
380 |
if ( isset( $current_screen ) && 'upload' === $current_screen->base && 'grid' === $media_library_mode ) {
|
381 |
|
382 |
wp_dequeue_script( 'media' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
}
|
385 |
}
|
501 |
);
|
502 |
|
503 |
|
504 |
+
// TODO:
|
505 |
+
// wp_enqueue_script(
|
506 |
+
// 'wpuxss-eml-tags-box-script',
|
507 |
+
// '/wp-admin/js/tags-box.js',
|
508 |
+
// array(),
|
509 |
+
// EML_VERSION,
|
510 |
+
// true
|
511 |
+
// );
|
512 |
|
513 |
|
514 |
$media_models_l10n = array(
|
593 |
$enhanced_medialist_l10n
|
594 |
);
|
595 |
}
|
596 |
+
|
597 |
+
|
598 |
+
// scripts for grid view :: /wp-admin/upload.php
|
599 |
+
if ( isset( $current_screen ) && 'upload' === $current_screen->base && 'grid' === $media_library_mode ) {
|
600 |
+
|
601 |
+
wp_enqueue_script(
|
602 |
+
'wpuxss-eml-media-grid-script',
|
603 |
+
$wpuxss_eml_dir . 'js/eml-media-grid.js',
|
604 |
+
array( 'media-grid'),
|
605 |
+
EML_VERSION,
|
606 |
+
true
|
607 |
+
);
|
608 |
+
|
609 |
+
wp_enqueue_script(
|
610 |
+
'wpuxss-eml-media-script',
|
611 |
+
$wpuxss_eml_dir . 'js/eml-media.js',
|
612 |
+
array( 'media-grid' ),
|
613 |
+
EML_VERSION,
|
614 |
+
true
|
615 |
+
);
|
616 |
+
|
617 |
+
$media_grid_l10n = array(
|
618 |
+
'grid_show_caption' => (int) $wpuxss_eml_lib_options['grid_show_caption'],
|
619 |
+
'grid_caption_type' => isset( $wpuxss_eml_lib_options['grid_caption_type'] ) ? sanitize_key( $wpuxss_eml_lib_options['grid_caption_type'] ) : 'title',
|
620 |
+
'more_details' => __( 'More Details', 'enhanced-media-library' ),
|
621 |
+
'less_details' => __( 'Less Details', 'enhanced-media-library' )
|
622 |
+
);
|
623 |
+
|
624 |
+
wp_localize_script(
|
625 |
+
'wpuxss-eml-media-grid-script',
|
626 |
+
'wpuxss_eml_media_grid_l10n',
|
627 |
+
$media_grid_l10n
|
628 |
+
);
|
629 |
+
}
|
630 |
}
|
631 |
}
|
632 |
|
js/eml-media-grid.js
CHANGED
@@ -51,21 +51,6 @@ window.eml = window.eml || { l10n: {} };
|
|
51 |
});
|
52 |
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
_.extend( media.view.Attachment.Details.prototype, {
|
57 |
-
|
58 |
-
editAttachment: function( event ) {
|
59 |
-
|
60 |
-
if ( this.controller.isModeActive( 'eml-grid' ) ) {
|
61 |
-
|
62 |
-
event.preventDefault();
|
63 |
-
this.controller.trigger( 'edit:attachment', this.model);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
});
|
67 |
-
|
68 |
-
|
69 |
|
70 |
newEvents = { 'click .eml-toggle-collapse': 'toggleCollapse' };
|
71 |
_.extend( newEvents, media.view.Attachment.Details.prototype.events);
|
@@ -347,22 +332,25 @@ window.eml = window.eml || { l10n: {} };
|
|
347 |
|
348 |
initialize: function() {
|
349 |
|
350 |
-
var self = this;
|
351 |
-
|
352 |
_.defaults( this.options, {
|
353 |
title : '',
|
354 |
modal : false,
|
355 |
|
356 |
selection: [],
|
357 |
library: {}, // Options hash for the query to the media library.
|
358 |
-
|
359 |
|
360 |
-
multiple :
|
361 |
state : 'library',
|
362 |
mode : [ 'eml-grid', 'edit' ]
|
363 |
});
|
364 |
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
366 |
|
367 |
// Ensure core and media grid view UI is enabled.
|
368 |
this.$el.addClass('wp-core-ui');
|
@@ -375,8 +363,9 @@ window.eml = window.eml || { l10n: {} };
|
|
375 |
// Append the frame view directly the supplied container.
|
376 |
this.$el.appendTo( this.options.container );
|
377 |
|
378 |
-
this.
|
379 |
this.render();
|
|
|
380 |
|
381 |
media.frames.browse = this;
|
382 |
},
|
@@ -394,33 +383,86 @@ window.eml = window.eml || { l10n: {} };
|
|
394 |
new media.controller.Library({
|
395 |
library : media.query( options.library ),
|
396 |
title : options.title,
|
397 |
-
multiple : options.multiple,
|
398 |
|
399 |
content : 'browse',
|
400 |
toolbar : 'bulk-edit',
|
401 |
menu : false,
|
402 |
router : false,
|
403 |
|
404 |
-
contentUserSetting : true,
|
405 |
|
406 |
-
searchable : true,
|
407 |
filterable : 'all',
|
408 |
|
409 |
-
autoSelect : true,
|
410 |
idealColumnWidth : $( window ).width() < 640 ? 135 : 175
|
|
|
|
|
411 |
})
|
412 |
]);
|
413 |
},
|
414 |
|
415 |
-
|
416 |
|
417 |
-
|
|
|
418 |
|
419 |
this.on( 'toolbar:create:bulk-edit', this.createToolbar, this );
|
420 |
this.on( 'toolbar:render:bulk-edit', this.selectionStatusToolbar, this );
|
421 |
this.on( 'edit:attachment', this.openEditAttachmentModal, this );
|
422 |
},
|
423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
selectionStatusToolbar: function( view ) {
|
425 |
|
426 |
view.set( 'selection', new media.view.emlGridSelection({
|
@@ -451,7 +493,7 @@ window.eml = window.eml || { l10n: {} };
|
|
451 |
sortable: state.get('sortable'),
|
452 |
search: state.get('searchable'),
|
453 |
filters: state.get('filterable'),
|
454 |
-
date: state.get('date'),
|
455 |
display: state.has('display') ? state.get('display') : state.get('displaySettings'),
|
456 |
dragInfo: state.get('dragInfo'),
|
457 |
|
@@ -474,11 +516,13 @@ window.eml = window.eml || { l10n: {} };
|
|
474 |
},
|
475 |
|
476 |
startHistory: function() {
|
477 |
-
|
478 |
-
// Verify pushState support and activate
|
479 |
if ( window.history && window.history.pushState ) {
|
|
|
|
|
|
|
480 |
Backbone.history.start( {
|
481 |
-
root: _wpMediaGridSettings.adminUrl,
|
482 |
pushState: true
|
483 |
} );
|
484 |
}
|
@@ -486,7 +530,7 @@ window.eml = window.eml || { l10n: {} };
|
|
486 |
|
487 |
openEditAttachmentModal: function( model ) {
|
488 |
|
489 |
-
wp.media( {
|
490 |
frame: 'edit-attachments',
|
491 |
controller: this,
|
492 |
library: this.state().get('library'),
|
@@ -497,22 +541,35 @@ window.eml = window.eml || { l10n: {} };
|
|
497 |
|
498 |
|
499 |
|
|
|
|
|
|
|
|
|
|
|
500 |
|
501 |
_.extend( media.view.UploaderInline.prototype, {
|
502 |
|
503 |
show: function() {
|
504 |
|
505 |
-
|
|
|
|
|
|
|
506 |
if ( this.controller.browserView ) {
|
507 |
-
this.controller.browserView.
|
|
|
508 |
}
|
509 |
},
|
510 |
|
511 |
hide: function() {
|
512 |
|
513 |
-
|
|
|
|
|
|
|
514 |
if ( this.controller.browserView ) {
|
515 |
-
this.controller.browserView.
|
|
|
516 |
}
|
517 |
}
|
518 |
});
|
@@ -536,18 +593,7 @@ window.eml = window.eml || { l10n: {} };
|
|
536 |
|
537 |
|
538 |
|
539 |
-
|
540 |
-
$( document ).ready( function() {
|
541 |
-
|
542 |
-
media.frame = new media.view.MediaFrame.emlGrid({
|
543 |
-
container: $('#wp-media-grid')
|
544 |
-
});
|
545 |
-
});
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
// TODO: move to PHP side
|
551 |
$('body').addClass('eml-grid');
|
552 |
|
553 |
|
51 |
});
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
newEvents = { 'click .eml-toggle-collapse': 'toggleCollapse' };
|
56 |
_.extend( newEvents, media.view.Attachment.Details.prototype.events);
|
332 |
|
333 |
initialize: function() {
|
334 |
|
|
|
|
|
335 |
_.defaults( this.options, {
|
336 |
title : '',
|
337 |
modal : false,
|
338 |
|
339 |
selection: [],
|
340 |
library: {}, // Options hash for the query to the media library.
|
341 |
+
uploader: true,
|
342 |
|
343 |
+
multiple : true,
|
344 |
state : 'library',
|
345 |
mode : [ 'eml-grid', 'edit' ]
|
346 |
});
|
347 |
|
348 |
+
// this.$body = $( document.body );
|
349 |
+
// this.$window = $( window );
|
350 |
+
// this.$adminBar = $( '#wpadminbar' );
|
351 |
+
this.$uploaderToggler = $( '.page-title-action' )
|
352 |
+
.attr( 'aria-expanded', 'false' )
|
353 |
+
.on( 'click', _.bind( this.addNewClickHandler, this ) );
|
354 |
|
355 |
// Ensure core and media grid view UI is enabled.
|
356 |
this.$el.addClass('wp-core-ui');
|
363 |
// Append the frame view directly the supplied container.
|
364 |
this.$el.appendTo( this.options.container );
|
365 |
|
366 |
+
this.bindRegionModeHandlers();
|
367 |
this.render();
|
368 |
+
this.bindSearchHandler();
|
369 |
|
370 |
media.frames.browse = this;
|
371 |
},
|
383 |
new media.controller.Library({
|
384 |
library : media.query( options.library ),
|
385 |
title : options.title,
|
386 |
+
multiple : options.multiple ? 'reset' : false,
|
387 |
|
388 |
content : 'browse',
|
389 |
toolbar : 'bulk-edit',
|
390 |
menu : false,
|
391 |
router : false,
|
392 |
|
393 |
+
// contentUserSetting : false, //true,
|
394 |
|
395 |
+
// searchable : true,
|
396 |
filterable : 'all',
|
397 |
|
398 |
+
// autoSelect : false, // true,
|
399 |
idealColumnWidth : $( window ).width() < 640 ? 135 : 175
|
400 |
+
|
401 |
+
// editable: true,
|
402 |
})
|
403 |
]);
|
404 |
},
|
405 |
|
406 |
+
bindRegionModeHandlers: function() {
|
407 |
|
408 |
+
this.on( 'select:activate', this.bindKeydown, this );
|
409 |
+
this.on( 'select:deactivate', this.unbindKeydown, this );
|
410 |
|
411 |
this.on( 'toolbar:create:bulk-edit', this.createToolbar, this );
|
412 |
this.on( 'toolbar:render:bulk-edit', this.selectionStatusToolbar, this );
|
413 |
this.on( 'edit:attachment', this.openEditAttachmentModal, this );
|
414 |
},
|
415 |
|
416 |
+
bindSearchHandler: function() {
|
417 |
+
|
418 |
+
var search = this.$( '#media-search-input' ),
|
419 |
+
searchView = this.browserView.toolbar.get( 'search' ).$el,
|
420 |
+
listMode = this.$( '.view-list' ),
|
421 |
+
|
422 |
+
|
423 |
+
input = _.throttle( function (e) {
|
424 |
+
|
425 |
+
var val = $( e.currentTarget ).val(),
|
426 |
+
url = val ? '?search=' + val : '';
|
427 |
+
|
428 |
+
this.gridRouter.navigate( this.gridRouter.baseUrl( url ), { replace: true } );
|
429 |
+
|
430 |
+
}, 1000 );
|
431 |
+
|
432 |
+
// Update the URL when entering search string (at most once per second).
|
433 |
+
search.on( 'input', _.bind( input, this ) );
|
434 |
+
|
435 |
+
this.gridRouter
|
436 |
+
.on( 'route:search', function () {
|
437 |
+
var href = window.location.href;
|
438 |
+
if ( href.indexOf( 'mode=' ) > -1 ) {
|
439 |
+
href = href.replace( /mode=[^&]+/g, 'mode=list' );
|
440 |
+
} else {
|
441 |
+
href += href.indexOf( '?' ) > -1 ? '&mode=list' : '?mode=list';
|
442 |
+
}
|
443 |
+
href = href.replace( 'search=', 's=' );
|
444 |
+
listMode.prop( 'href', href );
|
445 |
+
})
|
446 |
+
.on( 'route:reset', function() {
|
447 |
+
searchView.val( '' ).trigger( 'input' );
|
448 |
+
});
|
449 |
+
},
|
450 |
+
|
451 |
+
handleKeydown: function( e ) {
|
452 |
+
if ( 27 === e.which ) {
|
453 |
+
e.preventDefault();
|
454 |
+
this.deactivateMode( 'select' ).activateMode( 'edit' );
|
455 |
+
}
|
456 |
+
},
|
457 |
+
|
458 |
+
bindKeydown: function() {
|
459 |
+
this.$body.on( 'keydown.select', _.bind( this.handleKeydown, this ) );
|
460 |
+
},
|
461 |
+
|
462 |
+
unbindKeydown: function() {
|
463 |
+
this.$body.off( 'keydown.select' );
|
464 |
+
},
|
465 |
+
|
466 |
selectionStatusToolbar: function( view ) {
|
467 |
|
468 |
view.set( 'selection', new media.view.emlGridSelection({
|
493 |
sortable: state.get('sortable'),
|
494 |
search: state.get('searchable'),
|
495 |
filters: state.get('filterable'),
|
496 |
+
date: state.get('date'),
|
497 |
display: state.has('display') ? state.get('display') : state.get('displaySettings'),
|
498 |
dragInfo: state.get('dragInfo'),
|
499 |
|
516 |
},
|
517 |
|
518 |
startHistory: function() {
|
519 |
+
// Verify pushState support and activate.
|
|
|
520 |
if ( window.history && window.history.pushState ) {
|
521 |
+
if ( Backbone.History.started ) {
|
522 |
+
Backbone.history.stop();
|
523 |
+
}
|
524 |
Backbone.history.start( {
|
525 |
+
root: window._wpMediaGridSettings.adminUrl,
|
526 |
pushState: true
|
527 |
} );
|
528 |
}
|
530 |
|
531 |
openEditAttachmentModal: function( model ) {
|
532 |
|
533 |
+
media.frames.edit = wp.media( {
|
534 |
frame: 'edit-attachments',
|
535 |
controller: this,
|
536 |
library: this.state().get('library'),
|
541 |
|
542 |
|
543 |
|
544 |
+
original.UploaderInline = {
|
545 |
+
|
546 |
+
show: media.view.UploaderInline.prototype.show,
|
547 |
+
hide: media.view.UploaderInline.prototype.hide
|
548 |
+
};
|
549 |
|
550 |
_.extend( media.view.UploaderInline.prototype, {
|
551 |
|
552 |
show: function() {
|
553 |
|
554 |
+
var attachments;
|
555 |
+
|
556 |
+
original.UploaderInline.show.apply( this, arguments );
|
557 |
+
|
558 |
if ( this.controller.browserView ) {
|
559 |
+
attachments = this.controller.browserView.attachmentsWrapper || this.controller.browserView.attachments;
|
560 |
+
attachments.$el.css( 'top', this.$el.outerHeight() + 20 + 'px' );
|
561 |
}
|
562 |
},
|
563 |
|
564 |
hide: function() {
|
565 |
|
566 |
+
var attachments;
|
567 |
+
|
568 |
+
original.UploaderInline.hide.apply( this, arguments );
|
569 |
+
|
570 |
if ( this.controller.browserView ) {
|
571 |
+
attachments = this.controller.browserView.attachmentsWrapper || this.controller.browserView.attachments;
|
572 |
+
attachments.$el.css( 'top', 0 );
|
573 |
}
|
574 |
}
|
575 |
});
|
593 |
|
594 |
|
595 |
|
596 |
+
//TODO: move to PHP side
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
$('body').addClass('eml-grid');
|
598 |
|
599 |
|
js/eml-media-views.js
CHANGED
@@ -631,17 +631,18 @@ window.eml = window.eml || { l10n: {} };
|
|
631 |
|
632 |
fixLayout: function() {
|
633 |
|
634 |
-
var
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
$messages
|
639 |
-
$update_nag = $('.eml-media-css .update-nag')
|
|
|
640 |
|
641 |
|
642 |
if ( $update_nag.length ) {
|
643 |
$update_nag.css( 'margin-left', 15 + 'px' );
|
644 |
-
|
645 |
}
|
646 |
|
647 |
|
@@ -650,20 +651,18 @@ window.eml = window.eml || { l10n: {} };
|
|
650 |
return;
|
651 |
}
|
652 |
|
|
|
653 |
if ( this.controller.isModeActive( 'select' ) ) {
|
654 |
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
|
659 |
// TODO: find a better place for it, something like fixLayoutOnce
|
660 |
-
|
661 |
}
|
662 |
|
663 |
-
if ( this.controller.isModeActive( 'eml-grid' ) )
|
664 |
-
{
|
665 |
-
var messagesOuterHeight = 0;
|
666 |
-
|
667 |
|
668 |
if ( ! _.isUndefined( $messages ) )
|
669 |
{
|
@@ -674,8 +673,9 @@ window.eml = window.eml || { l10n: {} };
|
|
674 |
messagesOuterHeight = messagesOuterHeight ? messagesOuterHeight - 15 : 0;
|
675 |
}
|
676 |
|
677 |
-
|
678 |
-
|
|
|
679 |
}
|
680 |
},
|
681 |
|
@@ -743,7 +743,8 @@ window.eml = window.eml || { l10n: {} };
|
|
743 |
'widgets' === eml.l10n.current_screen ) {
|
744 |
|
745 |
|
746 |
-
if ( -1 !== $.inArray( 'types', eml.l10n.filters_to_show )
|
|
|
747 |
|
748 |
this.toolbar.set( 'filtersLabel', new media.view.Label({
|
749 |
value: l10n.filterByType,
|
@@ -1038,20 +1039,20 @@ window.eml = window.eml || { l10n: {} };
|
|
1038 |
|
1039 |
toggleSidebar: function() {
|
1040 |
|
1041 |
-
var selection = this.controller.state().get( 'selection' )
|
|
|
|
|
1042 |
|
1043 |
if ( selection.length ) {
|
1044 |
this.sidebar.$el.removeClass( 'hidden' );
|
1045 |
-
|
1046 |
-
this.$el.
|
1047 |
-
|
1048 |
this.controller.trigger( 'sidebar:on' );
|
1049 |
}
|
1050 |
else {
|
1051 |
this.sidebar.$el.addClass( 'hidden' );
|
1052 |
-
|
1053 |
-
this.$el.
|
1054 |
-
|
1055 |
this.controller.trigger( 'sidebar:off' );
|
1056 |
}
|
1057 |
},
|
@@ -1132,6 +1133,7 @@ window.eml = window.eml || { l10n: {} };
|
|
1132 |
},
|
1133 |
|
1134 |
createAttachments: function() {
|
|
|
1135 |
this.attachments = new media.view.Attachments({
|
1136 |
controller: this.controller,
|
1137 |
collection: this.collection,
|
@@ -1149,10 +1151,16 @@ window.eml = window.eml || { l10n: {} };
|
|
1149 |
this.controller.on( 'attachment:keydown:arrow', _.bind( this.attachments.arrowEvent, this.attachments ) );
|
1150 |
this.controller.on( 'attachment:details:shift-tab', _.bind( this.attachments.restoreFocus, this.attachments ) );
|
1151 |
|
1152 |
-
|
1153 |
-
|
|
|
|
|
|
|
|
|
|
|
1154 |
|
1155 |
-
if ( this.controller.isModeActive( 'grid' ) ||
|
|
|
1156 |
this.attachmentsNoResults = new media.View({
|
1157 |
controller: this.controller,
|
1158 |
tagName: 'p'
|
631 |
|
632 |
fixLayout: function() {
|
633 |
|
634 |
+
var browserView = this,
|
635 |
+
attachments = browserView.attachmentsWrapper || browserView.attachments,
|
636 |
+
toolbar = browserView.toolbar,
|
637 |
+
|
638 |
+
$messages = $('.eml-media-css .updated:visible, .eml-media-css .error:visible, .eml-media-css .notice:visible, .eml-media-css .notice-error:visible, .eml-media-css .notice-warning:visible, .eml-media-css .notice-success:visible, .eml-media-css .notice-info:visible'),
|
639 |
+
$update_nag = $('.eml-media-css .update-nag'),
|
640 |
+
messagesOuterHeight = 0;
|
641 |
|
642 |
|
643 |
if ( $update_nag.length ) {
|
644 |
$update_nag.css( 'margin-left', 15 + 'px' );
|
645 |
+
browserView.$el.closest('.wrap').css( 'top', $update_nag.outerHeight() + 25 + 'px' );
|
646 |
}
|
647 |
|
648 |
|
651 |
return;
|
652 |
}
|
653 |
|
654 |
+
|
655 |
if ( this.controller.isModeActive( 'select' ) ) {
|
656 |
|
657 |
+
attachments.$el.css( 'top', toolbar.$el.height() + 10 + 'px' );
|
658 |
+
browserView.uploader.$el.css( 'top', toolbar.$el.height() + 10 + 'px' );
|
659 |
+
browserView.$el.find('.eml-loader').css( 'top', toolbar.$el.height() + 10 + 'px' );
|
660 |
|
661 |
// TODO: find a better place for it, something like fixLayoutOnce
|
662 |
+
toolbar.$el.find('.media-toolbar-secondary').prepend( toolbar.$el.find('.instructions') );
|
663 |
}
|
664 |
|
665 |
+
if ( this.controller.isModeActive( 'eml-grid' ) ) {
|
|
|
|
|
|
|
666 |
|
667 |
if ( ! _.isUndefined( $messages ) )
|
668 |
{
|
673 |
messagesOuterHeight = messagesOuterHeight ? messagesOuterHeight - 15 : 0;
|
674 |
}
|
675 |
|
676 |
+
browserView.$el.css( 'top', toolbar.$el.outerHeight() + messagesOuterHeight + 15 + 'px' );
|
677 |
+
toolbar.$el.css( 'top', - toolbar.$el.outerHeight() - 25 + 'px' );
|
678 |
+
attachments.$el.css( 'top', 0 );
|
679 |
}
|
680 |
},
|
681 |
|
743 |
'widgets' === eml.l10n.current_screen ) {
|
744 |
|
745 |
|
746 |
+
if ( -1 !== $.inArray( 'types', eml.l10n.filters_to_show ) ||
|
747 |
+
! this.controller.isModeActive( 'eml-grid' ) ) {
|
748 |
|
749 |
this.toolbar.set( 'filtersLabel', new media.view.Label({
|
750 |
value: l10n.filterByType,
|
1039 |
|
1040 |
toggleSidebar: function() {
|
1041 |
|
1042 |
+
var selection = this.controller.state().get( 'selection' ),
|
1043 |
+
attachments = this.attachmentsWrapper || this.attachments;
|
1044 |
+
|
1045 |
|
1046 |
if ( selection.length ) {
|
1047 |
this.sidebar.$el.removeClass( 'hidden' );
|
1048 |
+
attachments.$el.css( 'right', '300px' );
|
1049 |
+
this.uploader.$el.css( 'right', '310px' );
|
|
|
1050 |
this.controller.trigger( 'sidebar:on' );
|
1051 |
}
|
1052 |
else {
|
1053 |
this.sidebar.$el.addClass( 'hidden' );
|
1054 |
+
attachments.$el.css( 'right', 0 );
|
1055 |
+
this.uploader.$el.css( 'right', '10px' );
|
|
|
1056 |
this.controller.trigger( 'sidebar:off' );
|
1057 |
}
|
1058 |
},
|
1133 |
},
|
1134 |
|
1135 |
createAttachments: function() {
|
1136 |
+
|
1137 |
this.attachments = new media.view.Attachments({
|
1138 |
controller: this.controller,
|
1139 |
collection: this.collection,
|
1151 |
this.controller.on( 'attachment:keydown:arrow', _.bind( this.attachments.arrowEvent, this.attachments ) );
|
1152 |
this.controller.on( 'attachment:details:shift-tab', _.bind( this.attachments.restoreFocus, this.attachments ) );
|
1153 |
|
1154 |
+
// Backward 5.x compatibility
|
1155 |
+
if ( this.attachmentsWrapper ) {
|
1156 |
+
this.views.add( '.attachments-wrapper', this.attachments );
|
1157 |
+
}
|
1158 |
+
else {
|
1159 |
+
this.views.add( this.attachments );
|
1160 |
+
}
|
1161 |
|
1162 |
+
if ( this.controller.isModeActive( 'grid' ) ||
|
1163 |
+
this.controller.isModeActive( 'eml-grid' ) ) {
|
1164 |
this.attachmentsNoResults = new media.View({
|
1165 |
controller: this.controller,
|
1166 |
tagName: 'p'
|
js/eml-media.js
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Creates a dialog containing posts that can have a particular media attached
|
3 |
+
* to it.
|
4 |
+
*
|
5 |
+
* @since 2.7.0
|
6 |
+
* @output wp-admin/js/media.js
|
7 |
+
*
|
8 |
+
* @namespace findPosts
|
9 |
+
*
|
10 |
+
* @requires jQuery
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* global ajaxurl, _wpMediaGridSettings, showNotice, findPosts */
|
14 |
+
|
15 |
+
( function( $ ){
|
16 |
+
window.findPosts = {
|
17 |
+
/**
|
18 |
+
* Opens a dialog to attach media to a post.
|
19 |
+
*
|
20 |
+
* Adds an overlay prior to retrieving a list of posts to attach the media to.
|
21 |
+
*
|
22 |
+
* @since 2.7.0
|
23 |
+
*
|
24 |
+
* @memberOf findPosts
|
25 |
+
*
|
26 |
+
* @param {string} af_name The name of the affected element.
|
27 |
+
* @param {string} af_val The value of the affected post element.
|
28 |
+
*
|
29 |
+
* @return {boolean} Always returns false.
|
30 |
+
*/
|
31 |
+
open: function( af_name, af_val ) {
|
32 |
+
var overlay = $( '.ui-find-overlay' );
|
33 |
+
|
34 |
+
if ( overlay.length === 0 ) {
|
35 |
+
$( 'body' ).append( '<div class="ui-find-overlay"></div>' );
|
36 |
+
findPosts.overlay();
|
37 |
+
}
|
38 |
+
|
39 |
+
overlay.show();
|
40 |
+
|
41 |
+
if ( af_name && af_val ) {
|
42 |
+
// #affected is a hidden input field in the dialog that keeps track of which media should be attached.
|
43 |
+
$( '#affected' ).attr( 'name', af_name ).val( af_val );
|
44 |
+
}
|
45 |
+
|
46 |
+
$( '#find-posts' ).show();
|
47 |
+
|
48 |
+
// Close the dialog when the escape key is pressed.
|
49 |
+
$('#find-posts-input').focus().keyup( function( event ){
|
50 |
+
if ( event.which == 27 ) {
|
51 |
+
findPosts.close();
|
52 |
+
}
|
53 |
+
});
|
54 |
+
|
55 |
+
// Retrieves a list of applicable posts for media attachment and shows them.
|
56 |
+
findPosts.send();
|
57 |
+
|
58 |
+
return false;
|
59 |
+
},
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Clears the found posts lists before hiding the attach media dialog.
|
63 |
+
*
|
64 |
+
* @since 2.7.0
|
65 |
+
*
|
66 |
+
* @memberOf findPosts
|
67 |
+
*
|
68 |
+
* @return {void}
|
69 |
+
*/
|
70 |
+
close: function() {
|
71 |
+
$('#find-posts-response').empty();
|
72 |
+
$('#find-posts').hide();
|
73 |
+
$( '.ui-find-overlay' ).hide();
|
74 |
+
},
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Binds a click event listener to the overlay which closes the attach media
|
78 |
+
* dialog.
|
79 |
+
*
|
80 |
+
* @since 3.5.0
|
81 |
+
*
|
82 |
+
* @memberOf findPosts
|
83 |
+
*
|
84 |
+
* @return {void}
|
85 |
+
*/
|
86 |
+
overlay: function() {
|
87 |
+
$( '.ui-find-overlay' ).on( 'click', function () {
|
88 |
+
findPosts.close();
|
89 |
+
});
|
90 |
+
},
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Retrieves and displays posts based on the search term.
|
94 |
+
*
|
95 |
+
* Sends a post request to the admin_ajax.php, requesting posts based on the
|
96 |
+
* search term provided by the user. Defaults to all posts if no search term is
|
97 |
+
* provided.
|
98 |
+
*
|
99 |
+
* @since 2.7.0
|
100 |
+
*
|
101 |
+
* @memberOf findPosts
|
102 |
+
*
|
103 |
+
* @return {void}
|
104 |
+
*/
|
105 |
+
send: function() {
|
106 |
+
var post = {
|
107 |
+
ps: $( '#find-posts-input' ).val(),
|
108 |
+
action: 'find_posts',
|
109 |
+
_ajax_nonce: $('#_ajax_nonce').val()
|
110 |
+
},
|
111 |
+
spinner = $( '.find-box-search .spinner' );
|
112 |
+
|
113 |
+
spinner.addClass( 'is-active' );
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Send a POST request to admin_ajax.php, hide the spinner and replace the list
|
117 |
+
* of posts with the response data. If an error occurs, display it.
|
118 |
+
*/
|
119 |
+
$.ajax( ajaxurl, {
|
120 |
+
type: 'POST',
|
121 |
+
data: post,
|
122 |
+
dataType: 'json'
|
123 |
+
}).always( function() {
|
124 |
+
spinner.removeClass( 'is-active' );
|
125 |
+
}).done( function( x ) {
|
126 |
+
if ( ! x.success ) {
|
127 |
+
$( '#find-posts-response' ).text( wp.i18n.__( 'An error has occurred. Please reload the page and try again.' ) );
|
128 |
+
}
|
129 |
+
|
130 |
+
$( '#find-posts-response' ).html( x.data );
|
131 |
+
}).fail( function() {
|
132 |
+
$( '#find-posts-response' ).text( wp.i18n.__( 'An error has occurred. Please reload the page and try again.' ) );
|
133 |
+
});
|
134 |
+
}
|
135 |
+
};
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Initializes the file once the DOM is fully loaded and attaches events to the
|
139 |
+
* various form elements.
|
140 |
+
*
|
141 |
+
* @return {void}
|
142 |
+
*/
|
143 |
+
$( document ).ready( function() {
|
144 |
+
var settings, $mediaGridWrap = $( '#wp-media-grid' );
|
145 |
+
|
146 |
+
// Opens a manage media frame into the grid.
|
147 |
+
if ( $mediaGridWrap.length && window.wp && window.wp.media ) {
|
148 |
+
settings = _wpMediaGridSettings;
|
149 |
+
|
150 |
+
// var frame = window.wp.media({
|
151 |
+
var frame = new window.wp.media.view.MediaFrame.emlGrid({
|
152 |
+
frame: 'eml-grid',
|
153 |
+
container: $mediaGridWrap,
|
154 |
+
library: settings.queryVars
|
155 |
+
}).open();
|
156 |
+
|
157 |
+
// Fire a global ready event.
|
158 |
+
$mediaGridWrap.trigger( 'wp-media-grid-ready', frame );
|
159 |
+
}
|
160 |
+
|
161 |
+
// Prevents form submission if no post has been selected.
|
162 |
+
$( '#find-posts-submit' ).click( function( event ) {
|
163 |
+
if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
|
164 |
+
event.preventDefault();
|
165 |
+
});
|
166 |
+
|
167 |
+
// Submits the search query when hitting the enter key in the search input.
|
168 |
+
$( '#find-posts .find-box-search :input' ).keypress( function( event ) {
|
169 |
+
if ( 13 == event.which ) {
|
170 |
+
findPosts.send();
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
});
|
174 |
+
|
175 |
+
// Binds the click event to the search button.
|
176 |
+
$( '#find-posts-search' ).click( findPosts.send );
|
177 |
+
|
178 |
+
// Binds the close dialog click event.
|
179 |
+
$( '#find-posts-close' ).click( findPosts.close );
|
180 |
+
|
181 |
+
// Binds the bulk action events to the submit buttons.
|
182 |
+
$( '#doaction, #doaction2' ).click( function( event ) {
|
183 |
+
|
184 |
+
/*
|
185 |
+
* Retrieves all select elements for bulk actions that have a name starting with `action`
|
186 |
+
* and handle its action based on its value.
|
187 |
+
*/
|
188 |
+
$( 'select[name^="action"]' ).each( function() {
|
189 |
+
var optionValue = $( this ).val();
|
190 |
+
|
191 |
+
if ( 'attach' === optionValue ) {
|
192 |
+
event.preventDefault();
|
193 |
+
findPosts.open();
|
194 |
+
} else if ( 'delete' === optionValue ) {
|
195 |
+
if ( ! showNotice.warn() ) {
|
196 |
+
event.preventDefault();
|
197 |
+
}
|
198 |
+
}
|
199 |
+
});
|
200 |
+
});
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Enables clicking on the entire table row.
|
204 |
+
*
|
205 |
+
* @return {void}
|
206 |
+
*/
|
207 |
+
$( '.find-box-inside' ).on( 'click', 'tr', function() {
|
208 |
+
$( this ).find( '.found-radio input' ).prop( 'checked', true );
|
209 |
+
});
|
210 |
+
});
|
211 |
+
})( jQuery );
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: webbistro
|
3 |
Tags: media library, media category, media categories, media gallery, gallery shortcode, media tag, media tags, media taxonomy, media taxonomies, media uploader, mime type, mime, mime types, file types, media types, media filter, attachment, gallery, image, images, media, ux, user experience, wp-admin, admin, taxonomy, taxonomies
|
4 |
Requires at least: 5.0
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -185,6 +185,16 @@ Please notice that you use Enhanced Media Library with other plugins that add me
|
|
185 |
|
186 |
## Changelog ##
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
### 2.8.5 ###
|
189 |
*Release Date - April 10, 2021*
|
190 |
|
2 |
Contributors: webbistro
|
3 |
Tags: media library, media category, media categories, media gallery, gallery shortcode, media tag, media tags, media taxonomy, media taxonomies, media uploader, mime type, mime, mime types, file types, media types, media filter, attachment, gallery, image, images, media, ux, user experience, wp-admin, admin, taxonomy, taxonomies
|
4 |
Requires at least: 5.0
|
5 |
+
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.8.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
185 |
|
186 |
## Changelog ##
|
187 |
|
188 |
+
### 2.8.6 ###
|
189 |
+
*Release Date - August 5, 2021*
|
190 |
+
|
191 |
+
= Compatibility =
|
192 |
+
* WordPress 5.8 compatibility ensured
|
193 |
+
|
194 |
+
= Bugfixes =
|
195 |
+
* A minor ACF-related bug fixed
|
196 |
+
|
197 |
+
|
198 |
### 2.8.5 ###
|
199 |
*Release Date - April 10, 2021*
|
200 |
|