media-views

Created Diff never expires
11 removals
698 lines
11 additions
698 lines
/*! This file is auto-generated */
/*! This file is auto-generated */
(() => {
(() => {
var i = {
var i = {
7145: (e) => {
7145: (e) => {
var s = wp.media.model.Selection,
var s = wp.media.model.Selection,
o = wp.media.controller.Library,
o = wp.media.controller.Library,
t = o.extend({
t = o.extend({
defaults: _.defaults(
defaults: _.defaults(
{
{
multiple: 'add',
multiple: 'add',
filterable: 'uploaded',
filterable: 'uploaded',
priority: 100,
priority: 100,
syncSelection: !1,
syncSelection: !1,
},
},
o.prototype.defaults
o.prototype.defaults
),
),
initialize: function () {
initialize: function () {
var e = this.get('collectionType');
var e = this.get('collectionType');
'video' === this.get('type') && (e = 'video-' + e),
'video' === this.get('type') && (e = 'video-' + e),
this.set('id', e + '-library'),
this.set('id', e + '-library'),
this.set('toolbar', e + '-add'),
this.set('toolbar', e + '-add'),
this.set('menu', e),
this.set('menu', e),
this.get('library') ||
this.get('library') ||
this.set(
this.set(
'library',
'library',
wp.media.query({ type: this.get('type') })
wp.media.query({ type: this.get('type') })
),
),
o.prototype.initialize.apply(this, arguments);
o.prototype.initialize.apply(this, arguments);
},
},
activate: function () {
activate: function () {
var e = this.get('library'),
var e = this.get('library'),
t = this.get('editLibrary'),
t = this.get('editLibrary'),
i = this.frame
i = this.frame
.state(this.get('collectionType') + '-edit')
.state(this.get('collectionType') + '-edit')
.get('library');
.get('library');
t && t !== i && e.unobserve(t),
t && t !== i && e.unobserve(t),
(e.validator = function (e) {
(e.validator = function (e) {
return (
return (
!!this.mirroring.get(e.cid) &&
!!this.mirroring.get(e.cid) &&
!i.get(e.cid) &&
!i.get(e.cid) &&
s.prototype.validator.apply(this, arguments)
s.prototype.validator.apply(this, arguments)
);
);
}),
}),
e.reset(e.mirroring.models, { silent: !0 }),
e.reset(e.mirroring.models, { silent: !0 }),
e.observe(i),
e.observe(i),
this.set('editLibrary', i),
this.set('editLibrary', i),
o.prototype.activate.apply(this, arguments);
o.prototype.activate.apply(this, arguments);
},
},
});
});
e.exports = t;
e.exports = t;
},
},
8612: (e) => {
8612: (e) => {
var t = wp.media.controller.Library,
var t = wp.media.controller.Library,
n = wp.media.view.l10n,
n = wp.media.view.l10n,
r = jQuery,
r = jQuery,
i = t.extend({
i = t.extend({
defaults: {
defaults: {
multiple: !1,
multiple: !1,
sortable: !0,
sortable: !0,
date: !1,
date: !1,
searchable: !1,
searchable: !1,
content: 'browse',
content: 'browse',
describe: !0,
describe: !0,
dragInfo: !0,
dragInfo: !0,
idealColumnWidth: 170,
idealColumnWidth: 170,
editing: !1,
editing: !1,
priority: 60,
priority: 60,
SettingsView: !1,
SettingsView: !1,
syncSelection: !1,
syncSelection: !1,
},
},
initialize: function () {
initialize: function () {
var e = this.get('collectionType');
var e = this.get('collectionType');
'video' === this.get('type') && (e = 'video-' + e),
'video' === this.get('type') && (e = 'video-' + e),
this.set('id', e + '-edit'),
this.set('id', e + '-edit'),
this.set('toolbar', e + '-edit'),
this.set('toolbar', e + '-edit'),
this.get('library') ||
this.get('library') ||
this.set('library', new wp.media.model.Selection()),
this.set('library', new wp.media.model.Selection()),
this.get('AttachmentView') ||
this.get('AttachmentView') ||
this.set(
this.set(
'AttachmentView',
'AttachmentView',
wp.media.view.Attachment.EditLibrary
wp.media.view.Attachment.EditLibrary
),
),
t.prototype.initialize.apply(this, arguments);
t.prototype.initialize.apply(this, arguments);
},
},
activate: function () {
activate: function () {
this.get('library').props.set('type', this.get('type')),
this.get('library').props.set('type', this.get('type')),
this.get('library').observe(wp.Uploader.queue),
this.get('library').observe(wp.Uploader.queue),
this.frame.on(
this.frame.on(
'content:render:browse',
'content:render:browse',
this.renderSettings,
this.renderSettings,
this
this
),
),
t.prototype.activate.apply(this, arguments);
t.prototype.activate.apply(this, arguments);
},
},
deactivate: function () {
deactivate: function () {
this.get('library').unobserve(wp.Uploader.queue),
this.get('library').unobserve(wp.Uploader.queue),
this.frame.off(
this.frame.off(
'content:render:browse',
'content:render:browse',
this.renderSettings,
this.renderSettings,
this
this
),
),
t.prototype.deactivate.apply(this, arguments);
t.prototype.deactivate.apply(this, arguments);
},
},
renderSettings: function (e) {
renderSettings: function (e) {
var t = this.get('library'),
var t = this.get('library'),
i = this.get('collectionType'),
i = this.get('collectionType'),
s = this.get('dragInfoText'),
s = this.get('dragInfoText'),
o = this.get('SettingsView'),
o = this.get('SettingsView'),
a = {};
a = {};
t &&
t &&
e &&
e &&
((t[i] = t[i] || new Backbone.Model()),
((t[i] = t[i] || new Backbone.Model()),
(a[i] = new o({ controller: this, model: t[i], priority: 40 })),
(a[i] = new o({ controller: this, model: t[i], priority: 40 })),
e.sidebar.set(a),
e.sidebar.set(a),
s &&
s &&
e.toolbar.set(
e.toolbar.set(
'dragInfo',
'dragInfo',
new wp.media.View({
new wp.media.View({
el: r('<div class="instructions">' + s + '</div>')[0],
el: r('<div class="instructions">' + s + '</div>')[0],
priority: -40,
priority: -40,
})
})
),
),
e.toolbar.set('reverse', {
e.toolbar.set('reverse', {
text: n.reverseOrder,
text: n.reverseOrder,
priority: 80,
priority: 80,
click: function () {
click: function () {
t.reset(t.toArray().reverse());
t.reset(t.toArray().reverse());
},
},
}));
}));
},
},
});
});
e.exports = i;
e.exports = i;
},
},
5422: (e) => {
5422: (e) => {
var i = wp.media.view.l10n,
var i = wp.media.view.l10n,
t = wp.media.controller.State.extend({
t = wp.media.controller.State.extend({
defaults: {
defaults: {
id: 'cropper',
id: 'cropper',
title: i.cropImage,
title: i.cropImage,
toolbar: 'crop',
toolbar: 'crop',
content: 'crop',
content: 'crop',
router: !1,
router: !1,
canSkipCrop: !1,
canSkipCrop: !1,
doCropArgs: {},
doCropArgs: {},
},
},
activate: function () {
activate: function () {
this.frame.on(
this.frame.on(
'content:create:crop',
'content:create:crop',
this.createCropContent,
this.createCropContent,
this
this
),
),
this.frame.on('close', this.removeCropper, this),
this.frame.on('close', this.removeCropper, this),
this.set(
this.set(
'selection',
'selection',
new Backbone.Collection(this.frame._selection.single)
new Backbone.Collection(this.frame._selection.single)
);
);
},
},
deactivate: function () {
deactivate: function () {
this.frame.toolbar.mode('browse');
this.frame.toolbar.mode('browse');
},
},
createCropContent: function () {
createCropContent: function () {
(this.cropperView = new wp.media.view.Cropper({
(this.cropperView = new wp.media.view.Cropper({
controller: this,
controller: this,
attachment: this.get('selection').first(),
attachment: this.get('selection').first(),
})),
})),
this.cropperView.on(
this.cropperView.on(
'image-loaded',
'image-loaded',
this.createCropToolbar,
this.createCropToolbar,
this
this
),
),
this.frame.content.set(this.cropperView);
this.frame.content.set(this.cropperView);
},
},
removeCropper: function () {
removeCropper: function () {
this.imgSelect.cancelSelection(),
this.imgSelect.cancelSelection(),
this.imgSelect.setOptions({ remove: !0 }),
this.imgSelect.setOptions({ remove: !0 }),
this.imgSelect.update(),
this.imgSelect.update(),
this.cropperView.remove();
this.cropperView.remove();
},
},
createCropToolbar: function () {
createCropToolbar: function () {
var e = this.get('canSkipCrop') || !1,
var e = this.get('canSkipCrop') || !1,
t = {
t = {
controller: this.frame,
controller: this.frame,
items: {
items: {
insert: {
insert: {
style: 'primary',
style: 'primary',
text: i.cropImage,
text: i.cropImage,
priority: 80,
priority: 80,
requires: { library: !1, selection: !1 },
requires: { library: !1, selection: !1 },
click: function () {
click: function () {
var t = this.controller,
var t = this.controller,
e = t.state().get('selection').first();
e = t.state().get('selection').first();
e.set({
e.set({
cropDetails: t.state().imgSelect.getSelection(),
cropDetails: t.state().imgSelect.getSelection(),
}),
}),
this.$el.text(i.cropping),
this.$el.text(i.cropping),
this.$el.attr('disabled', !0),
this.$el.attr('disabled', !0),
t
t
.state()
.state()
.doCrop(e)
.doCrop(e)
.done(function (e) {
.done(function (e) {
t.trigger('cropped', e), t.close();
t.trigger('cropped', e), t.close();
})
})
.fail(function () {
.fail(function () {
t.trigger('content:error:crop');
t.trigger('content:error:crop');
});
});
},
},
},
},
},
},
};
};
e &&
e &&
_.extend(t.items, {
_.extend(t.items, {
skip: {
skip: {
style: 'secondary',
style: 'secondary',
text: i.skipCropping,
text: i.skipCropping,
priority: 70,
priority: 70,
requires: { library: !1, selection: !1 },
requires: { library: !1, selection: !1 },
click: function () {
click: function () {
var e = this.controller.state().get('selection').first();
var e = this.controller.state().get('selection').first();
this.controller.state().cropperView.remove(),
this.controller.state().cropperView.remove(),
this.controller.trigger('skippedcrop', e),
this.controller.trigger('skippedcrop', e),
this.controller.close();
this.controller.close();
},
},
},
},
}),
}),
this.frame.toolbar.set(new wp.media.view.Toolbar(t));
this.frame.toolbar.set(new wp.media.view.Toolbar(t));
},
},
doCrop: function (e) {
doCrop: function (e) {
return wp.ajax.post(
return wp.ajax.post(
'custom-header-crop',
'custom-header-crop',
_.extend({}, this.defaults.doCropArgs, {
_.extend({}, this.defaults.doCropArgs, {
nonce: e.get('nonces').edit,
nonce: e.get('nonces').edit,
id: e.get('id'),
id: e.get('id'),
cropDetails: e.get('cropDetails'),
cropDetails: e.get('cropDetails'),
})
})
);
);
},
},
});
});
e.exports = t;
e.exports = t;
},
},
9660: (e) => {
9660: (e) => {
var t = wp.media.controller.Cropper.extend({
var t = wp.media.controller.Cropper.extend({
doCrop: function (e) {
doCrop: function (e) {
var t = e.get('cropDetails'),
var t = e.get('cropDetails'),
i = this.get('control'),
i = this.get('control'),
s = t.width / t.height;
s = t.width / t.height;
return (
return (
i.params.flex_width && i.params.flex_height
i.params.flex_width && i.params.flex_height
? ((t.dst_width = t.width), (t.dst_height = t.height))
? ((t.dst_width = t.width), (t.dst_height = t.height))
: ((t.dst_width = i.params.flex_width
: ((t.dst_width = i.params.flex_width
? i.params.height * s
? i.params.height * s
: i.params.width),
: i.params.width),
(t.dst_height = i.params.flex_height
(t.dst_height = i.params.flex_height
? i.params.width / s
? i.params.width / s
: i.params.height)),
: i.params.height)),
wp.ajax.post('crop-image', {
wp.ajax.post('crop-image', {
wp_customize: 'on',
wp_customize: 'on',
nonce: e.get('nonces').edit,
nonce: e.get('nonces').edit,
id: e.get('id'),
id: e.get('id'),
context: i.id,
context: i.id,
cropDetails: t,
cropDetails: t,
})
})
);
);
},
},
});
});
e.exports = t;
e.exports = t;
},
},
5663: (e) => {
5663: (e) => {
var s = wp.media.view.l10n,
var s = wp.media.view.l10n,
t = wp.media.controller.State.extend({
t = wp.media.controller.State.extend({
defaults: {
defaults: {
id: 'edit-image',
id: 'edit-image',
title: s.editImage,
title: s.editImage,
menu: !1,
menu: !1,
toolbar: 'edit-image',
toolbar: 'edit-image',
content: 'edit-image',
content: 'edit-image',
url: '',
url: '',
},
},
activate: function () {
activate: function () {
this.frame.on(
this.frame.on(
'toolbar:render:edit-image',
'toolbar:render:edit-image',
_.bind(this.toolbar, this)
_.bind(this.toolbar, this)
);
);
},
},
deactivate: function () {
deactivate: function () {
this.frame.off('toolbar:render:edit-image');
this.frame.off('toolbar:render:edit-image');
},
},
toolbar: function () {
toolbar: function () {
var e = this.frame,
var e = this.frame,
t = e.lastState(),
t = e.lastState(),
i = t && t.id;
i = t && t.id;
e.toolbar.set(
e.toolbar.set(
new wp.media.view.Toolbar({
new wp.media.view.Toolbar({
controller: e,
controller: e,
items: {
items: {
back: {
back: {
style: 'primary',
style: 'primary',
text: s.back,
text: s.back,
priority: 20,
priority: 20,
click: function () {
click: function () {
i ? e.setState(i) : e.close();
i ? e.setState(i) : e.close();
},
},
},
},
},
},
})
})
);
);
},
},
});
});
e.exports = t;
e.exports = t;
},
},
4910: (e) => {
4910: (e) => {
var t = wp.media.view.l10n,
var t = wp.media.view.l10n,
n = Backbone.$,
n = Backbone.$,
t = wp.media.controller.State.extend({
t = wp.media.controller.State.extend({
defaults: {
defaults: {
id: 'embed',
id: 'embed',
title: t.insertFromUrlTitle,
title: t.insertFromUrlTitle,
content: 'embed',
content: 'embed',
menu: 'default',
menu: 'default',
toolbar: 'main-embed',
toolbar: 'main-embed',
priority: 120,
priority: 120,
type: 'link',
type: 'link',
url: '',
url: '',
metadata: {},
metadata: {},
},
},
sensitivity: 400,
sensitivity: 400,
initialize: function (e) {
initialize: function (e) {
(this.metadata = e.metadata),
(this.metadata = e.metadata),
(this.debouncedScan = _.debounce(
(this.debouncedScan = _.debounce(
_.bind(this.scan, this),
_.bind(this.scan, this),
this.sensitivity
this.sensitivity
)),
)),
(this.props = new Backbone.Model(this.metadata || { url: '' })),
(this.props = new Backbone.Model(this.metadata || { url: '' })),
this.props.on('change:url', this.debouncedScan, this),
this.props.on('change:url', this.debouncedScan, this),
this.props.on('change:url', this.refresh, this),
this.props.on('change:url', this.refresh, this),
this.on('scan', this.scanImage, this);
this.on('scan', this.scanImage, this);
},
},
scan: function () {
scan: function () {
var e,
var e,
t = this,
t = this,
i = { type: 'link', scanners: [] };
i = { type: 'link', scanners: [] };
this.props.get('url') && this.trigger('scan', i),
this.props.get('url') && this.trigger('scan', i),
i.scanners.length
i.scanners.length
? (e = i.scanners = n.when.apply(n, i.scanners)).always(
? (e = i.scanners = n.when.apply(n, i.scanners)).always(
function () {
function () {
t.get('scanners') === e && t.set('loading', !1);
t.get('scanners') === e && t.set('loading', !1);
}
}
)
)
: (i.scanners = null),
: (i.scanners = null),
(i.loading = !!i.scanners),
(i.loading = !!i.scanners),
this.set(i);
this.set(i);
},
},
scanImage: function (e) {
scanImage: function (e) {
var t = this.frame,
var t = this.frame,
i = this,
i = this,
s = this.props.get('url'),
s = this.props.get('url'),
o = new Image(),
o = new Image(),
a = n.Deferred();
a = n.Deferred();
e.scanners.push(a.promise()),
e.scanners.push(a.promise()),
(o.onload = function () {
(o.onload = function () {
a.resolve(),
a.resolve(),
i === t.state() &&
i === t.state() &&
s === i.props.get('url') &&
s === i.props.get('url') &&
(i.set({ type: 'image' }),
(i.set({ type: 'image' }),
i.props.set({ width: o.width, height: o.height }));
i.props.set({ width: o.width, height: o.height }));
}),
}),
(o.onerror = a.reject),
(o.onerror = a.reject),
(o.src = s);
(o.src = s);
},
},
refresh: function () {
refresh: function () {
this.frame.toolbar.get().refresh();
this.frame.toolbar.get().refresh();
},
},
reset: function () {
reset: function () {
this.props.clear().set({ url: '' }),
this.props.clear().set({ url: '' }),
this.active && this.refresh();
this.active && this.refresh();
},
},
});
});
e.exports = t;
e.exports = t;
},
},
1169: (e) => {
1169: (e) => {
var s = wp.media.model.Attachment,
var s = wp.media.model.Attachment,
t = wp.media.controller.Library,
t = wp.media.controller.Library,
i = wp.media.view.l10n,
i = wp.media.view.l10n,
i = t.extend({
i = t.extend({
defaults: _.defaults(
defaults: _.defaults(
{
{
id: 'featured-image',
id: 'featured-image',
title: i.setFeaturedImageTitle,
title: i.setFeaturedImageTitle,
multiple: !1,
multiple: !1,
filterable: 'uploaded',
filterable: 'uploaded',
toolbar: 'featured-image',
toolbar: 'featured-image',
priority: 60,
priority: 60,
syncSelection: !0,
syncSelection: !0,
},
},
t.prototype.defaults
t.prototype.defaults
),
),
initialize: function () {
initialize: function () {
var e, i;
var e, o;
this.get('library') ||
this.get('library') ||
this.set('library', wp.media.query({ type: 'image' })),
this.set('library', wp.media.query({ type: 'image' })),
t.prototype.initialize.apply(this, arguments),
t.prototype.initialize.apply(this, arguments),
(e = this.get('library')),
(e = this.get('library')),
(i = e.comparator),
(o = e.comparator),
(e.comparator = function (e, t) {
(e.comparator = function (e, t) {
(e = !!this.mirroring.get(e.cid)),
var i = !!this.mirroring.get(e.cid),
(t = !!this.mirroring.get(t.cid));
s = !!this.mirroring.get(t.cid);
return !e && t ? -1 : e && !t ? 1 : i.apply(this, arguments);
return !i && s ? -1 : i && !s ? 1 : o.apply(this, arguments);
}),
}),
e.observe(this.get('selection'));
e.observe(this.get('selection'));
},
},
activate: function () {
activate: function () {
this.frame.on('open', this.updateSelection, this),
this.frame.on('open', this.updateSelection, this),
t.prototype.activate.apply(this, arguments);
t.prototype.activate.apply(this, arguments);
},
},
deactivate: function () {
deactivate: function () {
this.frame.off('open', this.updateSelection, this),
this.frame.off('open', this.updateSelection, this),
t.prototype.deactivate.apply(this, arguments);
t.prototype.deactivate.apply(this, arguments);
},
},
updateSelection: function () {
updateSelection: function () {
var e,
var e,
t = this.get('selection'),
t = this.get('selection'),
i = wp.media.view.settings.post.featuredImageId;
i = wp.media.view.settings.post.featuredImageId;
'' !== i && -1 !== i && (e = s.get(i)).fetch(),
'' !== i && -1 !== i && (e = s.get(i)).fetch(),
t.reset(e ? [e] : []);
t.reset(e ? [e] : []);
},
},
});
});
e.exports = i;
e.exports = i;
},
},
7127: (e) => {
7127: (e) => {
var i = wp.media.model.Selection,
var i = wp.media.model.Selection,
s = wp.media.controller.Library,
s = wp.media.controller.Library,
t = wp.media.view.l10n,
t = wp.media.view.l10n,
t = s.extend({
t = s.extend({
defaults: _.defaults(
defaults: _.defaults(
{
{
id: 'gallery-library',
id: 'gallery-library',
title: t.addToGalleryTitle,
title: t.addToGalleryTitle,
multiple: 'add',
multiple: 'add',
filterable: 'uploaded',
filterable: 'uploaded',
menu: 'gallery',
menu: 'gallery',
toolbar: 'gallery-add',
toolbar: 'gallery-add',
priority: 100,
priority: 100,
syncSelection: !1,
syncSelection: !1,
},
},
s.prototype.defaults
s.prototype.defaults
),
),
initialize: function () {
initialize: function () {
this.get('library') ||
this.get('library') ||
this.set('library', wp.media.query({ type: 'image' })),
this.set('library', wp.media.query({ type: 'image' })),
s.prototype.initialize.apply(this, arguments);
s.prototype.initialize.apply(this, arguments);
},
},
activate: function () {
activate: function () {
var e = this.get('library'),
var e = this.get('library'),
t = this.frame.state('gallery-edit').get('library');
t = this.frame.state('gallery-edit').get('library');
this.editLibrary &&
this.editLibrary &&
this.editLibrary !== t &&
this.editLibrary !== t &&
e.unobserve(this.editLibrary),
e.unobserve(this.editLibrary),
(e.validator = function (e) {
(e.validator = function (e) {
return (
return (
!!this.mirroring.get(e.cid) &&
!!this.mirroring.get(e.cid) &&
!t.get(e.cid) &&
!t.get(e.cid) &&
i.prototype.validator.apply(this, arguments)
i.prototype.validator.apply(this, arguments)
);
);
}),
}),
e.reset(e.mirroring.models, { silent: !0 }),
e.reset(e.mirroring.models, { silent: !0 }),
e.observe(t),
e.observe(t),
(this.editLibrary = t),
(this.editLibrary = t),
s.prototype.activate.apply(this, arguments);
s.prototype.activate.apply(this, arguments);
},
},
});
});
e.exports = t;
e.exports = t;
},
},
2038: (e) => {
2038: (e) => {
var t = wp.media.controller.Library,
var t = wp.media.controller.Library,
i = wp.media.view.l10n,
i = wp.media.view.l10n,
s = t.extend({
s = t.extend({
defaults: {
defaults: {
id: 'gallery-edit',
id: 'gallery-edit',
title: i.editGalleryTitle,
title: i.editGalleryTitle,
multiple: !1,
multiple: !1,
searchable: !1,
searchable: !1,
sortable: !0,
sortable: !0,
date: !1,
date: !1,
display: !1,
display: !1,
content: 'browse',
content: 'browse',
toolbar: 'gallery-edit',
toolbar: 'gallery-edit',
describe: !0,
describe: !0,
displaySettings: !0,
displaySettings: !0,
dragInfo: !0,
dragInfo: !0,
idealColumnWidth: 170,
idealColumnWidth: 170,
editing: !1,
editing: !1,
priority: 60,
priority: 60,
syncSelection: !1,
syncSelection: !1,
},
},
initialize: function () {
initialize: function () {
this.get('library') ||
this.get('library') ||
this.set('library', new wp.media.model.Selection()),
this.set('library', new wp.media.model.Selection()),
this.get('AttachmentView') ||
this.get('AttachmentView') ||
this.set(
this.set(
'AttachmentView',
'AttachmentView',
wp.media.view.Attachment.EditLibrary
wp.media.view.Attachment.EditLibrary
),
),
t.prototype.initialize.apply(this, arguments);
t.prototype.initialize.apply(this, arguments);
},
},
activate: function () {
activate: function () {
this.get('library').props.set('type', 'image'),
this.get('library').props.set('type', 'image'),
this.get('library').observe(wp.Uploader.queue),
this.get('library').observe(wp.Uploader.queue),
this.frame.on(
this.frame.on(
'content:render:browse',
'content:render:browse',
this.gallerySettings,
this.gallerySettings,
this
this
),
),
t.prototype.activate.apply(this, arguments);
t.prototype.activate.apply(this, arguments);
},
},
deactivate: function () {
deactivate: function () {
this.get('library').unobserve(wp.Uploader.queue),
this.get('library').unobserve(wp.Uploader.queue),
this.frame.off(
this.frame.off(
'content:render:browse',
'content:render:browse',
this.gallerySettings,
this.gallerySettings,
this
this
),
),
t.prototype.deactivate.apply(this, arguments);
t.prototype.deactivate.apply(this, arguments);
},
},
gallerySettings: function (e) {
gallerySettings: function (e) {
var t;
var t;
this.get('displaySettings') &&
this.get('displaySettings') &&
(t = this.get('library')) &&
(t = this.get('library')) &&
e &&
e &&
((t.gallery = t.gallery || new Backbone.Model()),
((t.gallery = t.gallery || new Backbone.Model()),
e.sidebar.set({
e.sidebar.set({
gallery: new wp.media.view.Settings.Gallery({
gallery: new wp.media.view.Settings.Gallery({
controller: this,
controller: this,
model: t.gallery,
model: t.gallery,
priority: 40,
priority: 40,
}),
}),
}),
}),
e.toolbar.set('reverse', {
e.toolbar.set('reverse', {
text: i.reverseOrder,
text: i.reverseOrder,
priority: 80,
priority: 80,
click: function () {
click: function () {
t.reset(t.toArray().reverse());
t.reset(t.toArray().reverse());
},
},
}));
}));
},
},
});
});
e.exports = s;
e.exports = s;
},
},
705: (e) => {
705: (e) => {
var t = wp.media.controller.State,
var t = wp.media.controller.State,
i = wp.media.controller.Library,
i = wp.media.controller.Library,
s = wp.media.view.l10n,
s = wp.media.view.l10n,
s = t.extend({
s = t.extend({
defaults: _.defaults(
defaults: _.defaults(
{
{
id: 'image-details',
id: 'image-details',
title: s.imageDetailsTitle,
title: s.imageDetailsTitle,
content: 'image-details',
content: 'image-details',
menu: !1,
menu: !1,
router: !1,
router: !1,
toolbar: 'image-details',
toolbar: 'image-details',
editing: !1,
editing: !1,
priority: 60,
priority: 60,
},
},
i.prototype.defaults
i.prototype.defaults
),
),
initialize: function (e) {
initialize: function (e) {
(this.image = e.image),
(this.image = e.image),
t.prototype.initialize.apply(this, arguments);
t.prototype.initialize.apply(this, arguments);
},
},
activate: function () {
activate: function () {
this.frame.modal.$el.addClass('image-details');
this.frame.modal.$el.addClass('image-details');
},
},
});
});
e.exports = s;
e.exports = s;
},
},
472: (e) => {
472: (e) => {
var t = wp.media.view.l10n,
var t = wp.media.view.l10n,
i = window.getUserSetting,
i = window.getUserSetting,
s = window.setUserSetting,
s = window.setUserSetting,
t = wp.media.controller.State.extend({
t = wp.media.controller.State.extend({
defaults: {
defaults: {
id: 'library',
id: 'library',
title: t.mediaLibraryTitle,
title: t.mediaLibraryTitle,
multiple: !1,
multiple: !1,
content: 'upload',
content: 'upload',
menu: 'default',
menu: 'default',
router: 'browse',
router: 'browse',
toolbar: 'select',
toolbar: 'select',
searchable: !0,
searchable: !0,
filterable: !1,
filterable: !1,
sortable: !0,
sortable: !0,
autoSelect: !0,
autoSelect: !0,
describe: !1,
describe: !1,
contentUserSetting: !0,
contentUserSetting: !0,
syncSelection: !0,
syncSelection: !0,
},
},
initialize: function () {
initialize: function () {
var e = this.get('selection');
var e = this.get('selection');
this.get('library') || this.set('library', wp.media.query()),
this.get('library') || this.set('library', wp.media.query()),
e instanceof wp.media.model.Selection ||
e instanceof wp.media.model.Selection ||
((e = e) ||
((e = e) ||
((e = this.get('library').props.toJSON()),
((e = this.get('library').props.toJSON()),
(e = _.omit(e, 'orderby', 'query'))),
(e = _.omit(e, 'orderby', 'query'))),
this.set(
this.set(
'selection',
'selection',
new wp.media.model.Selection(null, {
new wp.media.model.Selection(null, {
multiple: this.get('multiple'),
multiple: this.get('multiple'),
props: e,
props: e,
})
})
)),
)),
this.resetDisplays();
this.resetDisplays();
},
},
activate: function () {
activate: function () {
this.syncSelection(),
this.syncSelection(),
wp.Uploader.queue.on('add', this.uploading, this),
wp.Uploader.queue.on('add', this.uploading, this),
this.get('selection').on(
this.get('selection').on(
'add remove reset',
'add remove reset',
this.refreshContent,
this.refreshContent,
this
this
),
),
this.get('router') &&
this.get('router') &&
this.get('contentUserSetting') &&
this.get('contentUserSetting') &&
(this.frame.on(
(this.frame.on(
'content:activate',
'content:activate',
this.saveContentMode,
this.saveContentMode,
this
this
),
),
this.set(
this.set(
'content',
'content',
i('libraryContent', this.get('content'))
i('libraryContent', this.get('content'))
));
));
},
},
deactivate: function () {
deactivate: function () {
this.recordSelection(),
this.recordSelection(),
this.frame.off('content:activate', this.saveContentMode, this),
this.frame.off('content:activate', this.saveContentMode, this),
this.get('selection').off(null, null, this),
this.get('selection').off(null, null, this),
wp.Uploader.queue.off(null, null, this);
wp.Uploader.queue.off(null, null, this);
},
},
reset: function () {
reset: function () {
this.get('selection').reset(),
this.get('selection').reset(),
this.resetDisplays(),
this.resetDisplays(),
this.refreshContent();
this.refreshContent();
},
},
resetDisplays: function () {
resetDisplays: function () {
var e = wp.media.view.settings.defaultProps;
var e = wp.media.view.settings.defaultProps;
(this._displays = []),
(this._displays = []),
(this._defaultDisplaySettings = {
(this._defaultDisplaySettings = {
align: i('align', e.align) || 'none',
align: i('align', e.align) || 'none',
size: i('imgsize', e.size) || 'medium',
size: i('imgsize', e.size) || 'medium',
link: i('urlbutton', e.link) || 'none',
link: i('urlbutton', e.link) || 'none',
});
});
},
},
display: function (e) {
display: function (e) {
var t = this._displays;
var t = this._displays;
return (
return (
t[e.cid] ||
t[e.cid] ||
(t[e.cid] = new Backbone.Model(
(t[e.cid] = new Backbone.Model(
this.defaultDisplaySettings(e)
this.defaultDisplaySettings(e)
)),
)),
t[e.cid]
t[e.cid]
);
);
},
},
defaultDisplaySettings: function (e) {
defaultDisplaySettings: function (e) {
var t = _.clone(this._defaultDisplaySettings);
var t = _.clone(this._defaultDisplaySettings);
return (
return (
(t.canEmbed = this.canEmbed(e)),
(t.canEmbed = this.canEmbed(e)),
t.canEmbed
t.canEmbed
? (t.link = 'embed')
? (t.link = 'embed')
: this.isImageAttachment(e) ||
: this.isImageAttachment(e) ||
'none' !== t.link ||
'none' !== t.link ||
(t.link = 'file'),
(t.link = 'file'),
t
t
);
);
},
},
isImageAttachment: function (e) {
isImageAttachment: function (e) {
return e.get('uploading')
return e.get('uploading')
? /\.(jpe?g|png|gif|webp|avif)$/i.test(e.get('filename'))
? /\.(jpe?g|png|gif|webp|avif)$/i.test(e.get('filename'))
: 'image' === e.get('type');
: 'image' === e.get('type');
},
},
canEmbed: function (e) {
canEmbed: function (e) {
if (!e.get('uploading')) {
if (!e.get('uploading')) {
var t = e.get('type');
var t = e.get('type');
if ('audio' !== t && 'video' !== t) return !1;
if ('audio' !== t && 'video' !== t) return !1;
}
}
return _.contains(
return _.contains(
wp.media.view.settings.embedExts,
wp.media.view.settings.embedExts,
e.get('filename').split('.').pop()
e.get('filename').split('.').pop()
);
);
},
},
refreshContent: function () {
refreshContent: function () {
var e = this.get('selection'),
var e = this.get('selection'),
t = this.frame,
t = this.frame,
i = t.router.get(),
i = t.router.get(),
t = t.content.mode();
t = t.content.mode();
this.active &&
this.active &&
!e.length &&
!e.length &&
i &&
i &&
!i.get(t) &&
!i.get(t) &&
this.frame.cont
this.frame.cont