: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
var l10n = wp.media.view.l10n,
* wp.media.controller.EditAttachmentMetadata
* A state for editing an attachment's metadata.
* @memberOf wp.media.controller
* @augments wp.media.controller.State
* @augments Backbone.Model
EditAttachmentMetadata = wp.media.controller.State.extend(/** @lends wp.media.controller.EditAttachmentMetadata.prototype */{
// Title string passed to the frame's title region view.
title: l10n.attachmentDetails,
content: 'edit-metadata',
module.exports = EditAttachmentMetadata;
* wp.media.view.MediaFrame.Manage.Router
* A router for handling the browser history and application state.
* @memberOf wp.media.view.MediaFrame.Manage
* @augments Backbone.Router
var Router = Backbone.Router.extend(/** @lends wp.media.view.MediaFrame.Manage.Router.prototype */{
'upload.php?item=:slug&mode=edit': 'editItem',
'upload.php?item=:slug': 'showItem',
'upload.php?search=:query': 'search',
// Map routes against the page URL.
baseUrl: function( url ) {
return 'upload.php' + url;
var frame = wp.media.frames.edit;
// Respond to the search route by filling the search field and triggering the input event.
search: function( query ) {
jQuery( '#media-search-input' ).val( query ).trigger( 'input' );
// Show the modal with a specific item.
showItem: function( query ) {
frame = media.frames.browse,
library = frame.state().get('library'),
// Trigger the media frame to open the correct item.
item = library.findWhere( { id: parseInt( query, 10 ) } );
item.set( 'skipHistory', true );
frame.trigger( 'edit:attachment', item );
item = media.attachment( query );
frame.listenTo( item, 'change', function( model ) {
frame.stopListening( item );
frame.trigger( 'edit:attachment', model );
// Show the modal in edit mode with a specific item.
editItem: function( query ) {
wp.media.frames.edit.content.mode( 'edit-details' );
var Details = wp.media.view.Attachment.Details,
* wp.media.view.Attachment.Details.TwoColumn
* A similar view to media.view.Attachment.Details
* for use in the Edit Attachment modal.
* @memberOf wp.media.view.Attachment.Details
* @augments wp.media.view.Attachment.Details
* @augments wp.media.view.Attachment
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
TwoColumn = Details.extend(/** @lends wp.media.view.Attachment.Details.TowColumn.prototype */{
template: wp.template( 'attachment-details-two-column' ),
this.controller.on( 'content:activate:edit-details', _.bind( this.editAttachment, this ) );
Details.prototype.initialize.apply( this, arguments );
editAttachment: function( event ) {
this.controller.content.mode( 'edit-image' );
* Noop this from parent class, doesn't apply here.
toggleSelectionHandler: function() {}
module.exports = TwoColumn;
var Button = wp.media.view.Button,
DeleteSelected = wp.media.view.DeleteSelectedButton,
DeleteSelectedPermanently;
* wp.media.view.DeleteSelectedPermanentlyButton
* When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
* @memberOf wp.media.view
* @augments wp.media.view.DeleteSelectedButton
* @augments wp.media.view.Button
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
DeleteSelectedPermanently = DeleteSelected.extend(/** @lends wp.media.view.DeleteSelectedPermanentlyButton.prototype */{
DeleteSelected.prototype.initialize.apply( this, arguments );
this.controller.on( 'select:activate', this.selectActivate, this );
this.controller.on( 'select:deactivate', this.selectDeactivate, this );
filterChange: function( model ) {
this.canShow = ( 'trash' === model.get( 'status' ) );
selectActivate: function() {
this.$el.toggleClass( 'hidden', ! this.canShow );
selectDeactivate: function() {
this.$el.addClass( 'hidden' );
Button.prototype.render.apply( this, arguments );
module.exports = DeleteSelectedPermanently;
var Button = wp.media.view.Button,
l10n = wp.media.view.l10n,
* wp.media.view.DeleteSelectedButton
* A button that handles bulk Delete/Trash logic
* @memberOf wp.media.view
* @augments wp.media.view.Button
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
DeleteSelected = Button.extend(/** @lends wp.media.view.DeleteSelectedButton.prototype */{
Button.prototype.initialize.apply( this, arguments );
if ( this.options.filters ) {
this.options.filters.model.on( 'change', this.filterChange, this );
this.controller.on( 'selection:toggle', this.toggleDisabled, this );
this.controller.on( 'select:activate', this.toggleDisabled, this );
filterChange: function( model ) {
if ( 'trash' === model.get( 'status' ) ) {
this.model.set( 'text', l10n.restoreSelected );
} else if ( wp.media.view.settings.mediaTrash ) {
this.model.set( 'text', l10n.trashSelected );
this.model.set( 'text', l10n.deletePermanently );
toggleDisabled: function() {
this.model.set( 'disabled', ! this.controller.state().get( 'selection' ).length );
Button.prototype.render.apply( this, arguments );
if ( this.controller.isModeActive( 'select' ) ) {
this.$el.addClass( 'delete-selected-button' );
this.$el.addClass( 'delete-selected-button hidden' );
module.exports = DeleteSelected;
var Button = wp.media.view.Button,
l10n = wp.media.view.l10n,
* wp.media.view.SelectModeToggleButton
* @memberOf wp.media.view
* @augments wp.media.view.Button
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
SelectModeToggle = Button.extend(/** @lends wp.media.view.SelectModeToggle.prototype */{
_.defaults( this.options, {
Button.prototype.initialize.apply( this, arguments );
this.controller.on( 'select:activate select:deactivate', this.toggleBulkEditHandler, this );
this.controller.on( 'selection:action:done', this.back, this );
this.controller.deactivateMode( 'select' ).activateMode( 'edit' );
Button.prototype.click.apply( this, arguments );
if ( this.controller.isModeActive( 'select' ) ) {
this.controller.deactivateMode( 'edit' ).activateMode( 'select' );
Button.prototype.render.apply( this, arguments );
this.$el.addClass( 'select-mode-toggle-button' );
toggleBulkEditHandler: function() {
var toolbar = this.controller.content.get().toolbar, children;
children = toolbar.$( '.media-toolbar-secondary > *, .media-toolbar-primary > *' );
// @todo The Frame should be doing all of this.
if ( this.controller.isModeActive( 'select' ) ) {
children.not( '.spinner, .media-button' ).hide();
toolbar.$el.addClass( 'media-toolbar-mode-select' );
toolbar.$( '.delete-selected-button' ).removeClass( 'hidden' );
this.controller.content.get().$el.removeClass( 'fixed' );
toolbar.$el.css( 'width', '' );
toolbar.$el.removeClass( 'media-toolbar-mode-select' );
toolbar.$( '.delete-selected-button' ).addClass( 'hidden' );
children.not( '.media-button' ).show();
this.controller.state().get( 'selection' ).reset();
module.exports = SelectModeToggle;
var View = wp.media.View,
EditImage = wp.media.view.EditImage,
* wp.media.view.EditImage.Details
* @memberOf wp.media.view.EditImage
* @augments wp.media.view.EditImage
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
Details = EditImage.extend(/** @lends wp.media.view.EditImage.Details.prototype */{
initialize: function( options ) {
this.editor = window.imageEdit;
this.frame = options.frame;
this.controller = options.controller;
View.prototype.initialize.apply( this, arguments );
this.frame.content.mode( 'edit-metadata' );
this.model.fetch().done( _.bind( function() {
this.frame.content.mode( 'edit-metadata' );
module.exports = Details;
var Frame = wp.media.view.Frame,
MediaFrame = wp.media.view.MediaFrame,
* wp.media.view.MediaFrame.EditAttachments
* A frame for editing the details of a specific media item.
* Opens in a modal by default.
* Requires an attachment model to be passed in the options hash under `model`.
* @memberOf wp.media.view.MediaFrame
* @augments wp.media.view.Frame
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
* @mixes wp.media.controller.StateMachine
EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAttachments.prototype */{
className: 'edit-attachment-frame',
template: wp.template( 'edit-attachment-frame' ),
regions: [ 'title', 'content' ],
'click .left': 'previousMediaItem',
'click .right': 'nextMediaItem'
Frame.prototype.initialize.apply( this, arguments );
_.defaults( this.options, {
this.controller = this.options.controller;
this.gridRouter = this.controller.gridRouter;
this.library = this.options.library;
if ( this.options.model ) {
this.model = this.options.model;
this.title.mode( 'default' );
bindHandlers: function() {
// Bind default title creation.
this.on( 'title:create:default', this.createTitle, this );
this.on( 'content:create:edit-metadata', this.editMetadataMode, this );
this.on( 'content:create:edit-image', this.editImageMode, this );
this.on( 'content:render:edit-image', this.editImageModeRender, this );
this.on( 'refresh', this.rerender, this );
this.on( 'close', this.detach );
this.bindModelHandlers();
this.listenTo( this.gridRouter, 'route:search', this.close, this );
bindModelHandlers: function() {
// Close the modal if the attachment is deleted.
this.listenTo( this.model, 'change:status destroy', this.close, this );
createModal: function() {
// Initialize modal container view.
if ( this.options.modal ) {
this.modal = new wp.media.view.Modal({
title: this.options.title,
this.modal.on( 'open', _.bind( function () {
$( 'body' ).on( 'keydown.media-modal', _.bind( this.keyEvent, this ) );
// Completely destroy the modal DOM element when closing it.
this.modal.on( 'close', _.bind( function() {
// Remove the keydown event.
$( 'body' ).off( 'keydown.media-modal' );