Skip to content

Commit

Permalink
Allow only png and jpg images for thumbnail and poster (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy authored Aug 23, 2024
1 parent 1adfe86 commit a769244
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions assets/js/src/views/video-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,19 @@ var VideoEditView = BrightcoveView.extend({
openMediaManager: function (evnt) {
evnt.preventDefault();

var elem = $(evnt.currentTarget).parents('.setting'),
editor = elem.data('editor'),
mediaManager = (wp.media.frames.brightcove = wp.media()),
that = this,
options = {
state: 'insert',
title: wp.media.view.l10n.addMedia,
multiple: false,
};
const options = {
title: wp.media.view.l10n.addMedia,
multiple: false,
library: {
type: ['image/jpeg', 'image/png'],
},
};

const mediaManager = wp.media(options);
const that = this;

// Open the media manager
mediaManager.open(editor, options);
mediaManager.open();

// Listen for selection of media
mediaManager.on('select', function () {
Expand Down Expand Up @@ -588,15 +589,6 @@ var VideoEditView = BrightcoveView.extend({
spinner.removeClass('is-active').addClass('hidden');
});

// If there's already a poster or thumbnail set, display it
if (this.model.get('poster')) {
this.displayAttachment('poster');
}

if (this.model.get('thumbnail')) {
this.displayAttachment('thumbnail');
}

// Captions
if (this.model.get('captions')) {
var captions = this.model.get('captions');
Expand Down

0 comments on commit a769244

Please sign in to comment.