Fixes missing button in the attachments media modal.
This commit is contained in:
parent
a8808bae0c
commit
a86434cb55
|
@ -1661,7 +1661,7 @@ export default {
|
|||
'my-attachment-media-frame', {
|
||||
button_labels: {
|
||||
frame_title: this.$i18n.get('instruction_select_files_to_attach_to_item'),
|
||||
frame_button: this.$i18n.get('label_attach_to_item'),
|
||||
frame_button: this.$i18n.get('finish'),
|
||||
},
|
||||
nonce: this.item.nonces ? this.item.nonces['update-post_' + this.item.id] : null,
|
||||
relatedPostId: this.itemId,
|
||||
|
@ -1670,6 +1670,7 @@ export default {
|
|||
onSave: () => {
|
||||
// Fetch current existing attachments
|
||||
this.shouldLoadAttachments = !this.shouldLoadAttachments;
|
||||
console.log('opa')
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2,45 +2,6 @@ export default {
|
|||
// AttachmentControl: requires upload of new files and accepts multiple files
|
||||
attachmentControl: wp.customize.MediaControl.extend({
|
||||
|
||||
/**
|
||||
* Set up gallery toolbar.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
galleryToolbar() {
|
||||
this.toolbar.set(
|
||||
new wp.media.view.Toolbar( {
|
||||
controller: this,
|
||||
items: {
|
||||
insert: {
|
||||
style: 'primary',
|
||||
text: wp.media.view.l10n.update,
|
||||
priority: 80,
|
||||
requires: { library: true },
|
||||
|
||||
/**
|
||||
* @fires wp.media.controller.State#select
|
||||
*/
|
||||
click() {
|
||||
const controller = this.controller,
|
||||
state = controller.state();
|
||||
|
||||
controller.close();
|
||||
state.trigger(
|
||||
'select',
|
||||
state.get( 'library' )
|
||||
);
|
||||
|
||||
// Restore and reset the default state.
|
||||
controller.setState( controller.options.state );
|
||||
controller.reset();
|
||||
},
|
||||
},
|
||||
},
|
||||
} )
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a media modal select frame, and store it so the instance can be reused when needed.
|
||||
*/
|
||||
|
@ -54,6 +15,9 @@ export default {
|
|||
wp.media.model.settings.post.id = parseInt(this.params.relatedPostId);
|
||||
|
||||
this.frame = wp.media({
|
||||
button: {
|
||||
text: this.params.button_labels.frame_button
|
||||
},
|
||||
states: [
|
||||
new wp.media.controller.Library({
|
||||
title: this.params.button_labels.frame_title,
|
||||
|
@ -64,7 +28,6 @@ export default {
|
|||
posts_per_page: -1,
|
||||
query: true
|
||||
}),
|
||||
toolbar: 'main-gallery',
|
||||
autoSelect: true,
|
||||
sortable: true,
|
||||
filterable: 'unattached',
|
||||
|
@ -72,8 +35,6 @@ export default {
|
|||
]
|
||||
}).open();
|
||||
|
||||
this.frame.on( 'toolbar:create:main-gallery', this.galleryToolbar, this.frame );
|
||||
|
||||
this.frame.$el.addClass( 'tainacan-item-attachments-modal' );
|
||||
this.frame.$el['tainacan-document-id'] = this.params.document;
|
||||
this.frame.$el['tainacan-thumbnail-id'] = this.params.thumbnailId;
|
||||
|
|
Loading…
Reference in New Issue